Skip to content

Uncaught (in promise) TypeError: Failed to fetch - React Native | Convex | Better Auth #669

@damien-schneider

Description

@damien-schneider

Using setup with:

  • React Native (with NativeWind)
  • Convex
  • Nextjs web app
  • Better Auth

When setting up the environment variable and the convex cloud, I was able to make the nextjs web app work perfectly and make the authentication working well.

But when trying the same for the react native app, I get multiple errors, and cannot even create an account in the app. I get the following error:

Image Image

Here is the .env of the react native application:

EXPO_PUBLIC_CONVEX_URL=https://posh-kangaroo-476.convex.cloud
EXPO_PUBLIC_CONVEX_SITE_URL=https://posh-kangaroo-476.convex.site

And there is ambiguity for the NATIVE_APP_URL, the SITE_URL and the backend/.env and the environment variables that we directly set in the convex dashboard UI

Other errors happening (but doesn't seem to impact directly the authentication):

Access to fetch at 'https://fantastic-cuttlefish-200.convex.site/api/auth/get-session' from origin 'http://localhost:8081' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET https://fantastic-cuttlefish-200.convex.site/api/auth/get-session net::ERR_FAILED 200 (OK)
Uncaught Error: Attempting to use a disconnected port object

Thanks a lot for your help by advance 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions