Skip to content

fix: add origin header to auth requests#132

Closed
AzizOuertani wants to merge 1 commit intomainfrom
AzizOuertani/fix-get-session-500
Closed

fix: add origin header to auth requests#132
AzizOuertani wants to merge 1 commit intomainfrom
AzizOuertani/fix-get-session-500

Conversation

@AzizOuertani
Copy link
Copy Markdown
Contributor

Summary

  • Adds an origin header (start-ui-native://) to all auth fetch requests in the Expo client
  • This prevents a crash in @better-auth/expo@1.5.0 server plugin on Node.js v24, where new Request(request, { headers }) fails with TypeError: Cannot read private member #state
  • With the origin header present, the expo plugin's onRequest hook returns early (line 44: if (!expoOrigin) return) and skips the buggy Request cloning code path

Context

The @better-auth/expo server plugin checks for an expo-origin header and, if found, tries to clone the Request object with a new origin header. On Node.js v24, this clone operation fails due to internal undici changes. By sending the origin header directly from the native app, the plugin sees no expo-origin header and exits early.

Alternative: update @better-auth/expo to >=1.5.1 on the web side.

Test plan

  • Run the Expo app locally against a Node 24 backend and verify get-session returns 200
  • Verify login/signup flows still work correctly
  • Verify the web app auth still works (no regression)

πŸ€– Generated with Claude Code

The @better-auth/expo server plugin crashes on Node 24 when cloning
the Request object. Sending the origin header makes the plugin return
early and skip the buggy code path entirely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 4, 2026

πŸš€ Expo preview is ready!

  • Project β†’ start-ui-native-v9iizxkbojzedvpfkfzcq
  • Platforms β†’ android, ios
  • Scheme β†’ start-ui-native
  • Runtime Version β†’ 1.0.0
  • More info

Learn more about 𝝠 Expo Github Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant