-
Notifications
You must be signed in to change notification settings - Fork 401
Closed
Labels
Description
Preliminary Checks
- I have reviewed the documentation: https://clerk.com/docs
- I have searched for existing issues: https://github.com/clerk/javascript/issues
- I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
- This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/statico/repro-clerk-connectivity
Publishable key
pk_test_Y2xlcmsuaW5zcGlyZWQubGlvbmZpc2gtMzgubGNsLmRldiQ
Description
Steps to reproduce:
Prerequisites:
- Enable your environment so that you can run an Expo Go app on iOS or Android: https://docs.expo.dev/ (basically, install Xcode or Android)
- Check out https://github.com/statico/repro-clerk-connectivity and run
pnpm install - Add a
.envfile withCLERK_PUBLISHABLE_KEY= - Run
pnpm startand then hitiorato open the app in iOS or Android - Use my publishable key or any Clerk instance with email/password and Google login enabled
Bug No. 1
- Ensure your network connection is working
- Open the app and click "Sign in with OAuth"
- Observe that OAuth sign in works just fine
- Click the Sign Out button
- Disable your network
- Optionally, reload the app to observe how long it takes for Clerk to load (presumably because it's retrying connections)
- Click the "Sign in with OAuth" button
- Observe the error "Cannot read property 'toString' of null"
- Observe "ClerkJS: Network error" in the console
Bug No. 2
- Ensure your network connection is working
- Open the app, enter a test email like
[email protected], and click "Sign In" - Observe the message "supportedFirstFactors is OK" — this means that the SignIn object was initialized with one or more first factor authentication strategies
- Disable your network
- Optionally, reload the app to observe how long it takes for Clerk to load (presumably because it's retrying connections)
- Again, enter a test email like
[email protected], and click "Sign In" - Observe the that supportedFirstFactors is empty, likely because the SignIn object was not initialized
- Observe "ClerkJS: Network error" in the console
Expected behavior:
- It takes a long time to wait for
isLoaded. If Clerk can't load itself, we should be able to propagate an error message to the user. Checking the NetInfo module for connectivity is not enough — the internet could appear to be up, but it might just be Clerk that is inaccessible. - When the network connections fail, Clerk prints an error, but there is no way to catch this error in order to report it to Sentry or the user.
- For OAuth, there should be a better catchable error message when the OAuth session cannot be started
- For identifier-based login, there should be a better catchable error message when the network is down
Thanks, Clerk team!
Environment
System:
OS: macOS 14.4.1
CPU: (12) arm64 Apple M2 Max
Memory: 1.92 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
npm: 10.8.1 - ~/.nvm/versions/node/v20.13.1/bin/npm
pnpm: 9.1.1 - ~/.nvm/versions/node/v20.13.1/bin/pnpm
Browsers:
Brave Browser: 125.1.66.113
Chrome: 125.0.6422.142
Safari: 17.4.1
npmPackages:
@types/uuid: 9.0.8 => 9.0.8
core-js: 3.37.1 => 3.37.1
jsdom: 24.0.0 => 24.0.0
p-limit: 5.0.0 => 5.0.0
react-select: 5.8.0 => 5.8.0
react-virtuoso: 4.7.10 => 4.7.10$ grep clerk packages/*/package.json
packages/mobile/package.json: "@clerk/clerk-expo": "1.1.4",
packages/mobile/package.json: "@clerk/clerk-js": "5.4.0",
packages/mobile/package.json: "@clerk/types": "4.4.0",
packages/web/package.json: "@clerk/clerk-sdk-node": "5.0.7",
packages/web/package.json: "@clerk/nextjs": "5.0.12",
patr0cl0, matejm, renniehaylock, tmoran-stenoa, romainlouvet and 2 more