Title: Expo/JavaScript client fails in strange ways with poor or no network connectivity · Issue #3563 · clerk/javascript · GitHub
Open Graph Title: Expo/JavaScript client fails in strange ways with poor or no network connectivity · Issue #3563 · clerk/javascript
X Title: Expo/JavaScript client fails in strange ways with poor or no network connectivity · Issue #3563 · clerk/javascript
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 hav...
Open Graph 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 ...
X 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 ...
Opengraph URL: https://github.com/clerk/javascript/issues/3563
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Expo/JavaScript client fails in strange ways with poor or no network connectivity","articleBody":"### Preliminary Checks\n\n- [X] I have reviewed the documentation: [https://clerk.com/docs](https://clerk.com/docs)\n- [X] I have searched for existing issues: [https://github.com/clerk/javascript/issues](https://github.com/clerk/javascript/issues)\n- [X] I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)\n- [X] 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](https://clerk.com/discord).\n\n### Reproduction\n\n[https://github.com/statico/repro-clerk-connectivity](https://github.com/statico/repro-clerk-connectivity)\n\n### Publishable key\n\npk_test_Y2xlcmsuaW5zcGlyZWQubGlvbmZpc2gtMzgubGNsLmRldiQ\n\n### Description\n\n**Steps to reproduce:**\n\nPrerequisites:\n\n* Enable your environment so that you can run an Expo Go app on iOS or Android: [https://docs.expo.dev/](https://docs.expo.dev/) (basically, install Xcode or Android)\n* Check out [https://github.com/statico/repro-clerk-connectivity](https://github.com/statico/repro-clerk-connectivity) and run `pnpm install`\n* Add a `.env` file with `CLERK_PUBLISHABLE_KEY=`\n* Run `pnpm start` and then hit `i` or `a` to open the app in iOS or Android\n* Use my publishable key or any Clerk instance with email/password and Google login enabled\n\nBug No. 1\n\n1. Ensure your network connection is working\n2. Open the app and click \"Sign in with OAuth\"\n3. Observe that OAuth sign in works just fine\n4. Click the Sign Out button\n5. Disable your network\n6. Optionally, reload the app to observe how long it takes for Clerk to load (presumably because it's retrying connections)\n7. Click the \"Sign in with OAuth\" button\n8. Observe the error \"Cannot read property 'toString' of null\"\n9. Observe \"ClerkJS: Network error\" in the console\n\nBug No. 2\n\n1. Ensure your network connection is working\n2. Open the app, enter a test email like `ian@pickleheads.com`, and click \"Sign In\"\n3. Observe the message \"supportedFirstFactors is OK\" — this means that the SignIn object was initialized with one or more first factor authentication strategies\n4. Disable your network\n5. Optionally, reload the app to observe how long it takes for Clerk to load (presumably because it's retrying connections)\n6. Again, enter a test email like `ian@pickleheads.com`, and click \"Sign In\"\n7. Observe the that supportedFirstFactors is empty, likely because the SignIn object was not initialized\n8. Observe \"ClerkJS: Network error\" in the console\n\n**Expected behavior:**\n\n1. 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.\n2. 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.\n3. For OAuth, there should be a better catchable error message when the OAuth session cannot be started\n4. For identifier-based login, there should be a better catchable error message when the network is down\n\nThanks, Clerk team!\n\n### Environment\n\n```Shell\nSystem:\n OS: macOS 14.4.1\n CPU: (12) arm64 Apple M2 Max\n Memory: 1.92 GB / 64.00 GB\n Shell: 5.9 - /bin/zsh\n Binaries:\n Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node\n npm: 10.8.1 - ~/.nvm/versions/node/v20.13.1/bin/npm\n pnpm: 9.1.1 - ~/.nvm/versions/node/v20.13.1/bin/pnpm\n Browsers:\n Brave Browser: 125.1.66.113\n Chrome: 125.0.6422.142\n Safari: 17.4.1\n npmPackages:\n @types/uuid: 9.0.8 => 9.0.8\n core-js: 3.37.1 => 3.37.1\n jsdom: 24.0.0 => 24.0.0\n p-limit: 5.0.0 => 5.0.0\n react-select: 5.8.0 => 5.8.0\n react-virtuoso: 4.7.10 => 4.7.10\n```\n\n```\n$ grep clerk packages/*/package.json\npackages/mobile/package.json: \"@clerk/clerk-expo\": \"1.1.4\",\npackages/mobile/package.json: \"@clerk/clerk-js\": \"5.4.0\",\npackages/mobile/package.json: \"@clerk/types\": \"4.4.0\",\npackages/web/package.json: \"@clerk/clerk-sdk-node\": \"5.0.7\",\npackages/web/package.json: \"@clerk/nextjs\": \"5.0.12\",\n```\n\n","author":{"url":"https://github.com/statico","@type":"Person","name":"statico"},"datePublished":"2024-06-13T00:42:37Z","url":"https://github.com/clerk/javascript/issues/3563"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ac02fd47-0030-672d-75ed-54b261a0113e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA1E:223A5F:C9BB5B:115D6C7:6AFB5909 |
| html-safe-nonce | 56fbd287990a2552a2c7ae9faa4b6aeab71eb67fe63b1412ed6a2cca9c969176 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTFFOjIyM0E1RjpDOUJCNUI6MTE1RDZDNzo2QUZCNTkwOSIsInZpc2l0b3JfaWQiOiI4MzI0NzMwMDg3MDcyODE1MzY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ca85da497439110b29ca8274847914fe2ea37ac09e3fe262b4751a3742382d75 |
| hovercard-subject-tag | issue:2349904733 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/clerk/javascript/3563/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a0b03d5246e14e92af22356a92e5706a5e9a53ec4e58af811a64e19b5e8841cd/clerk/javascript/issues/3563 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a0b03d5246e14e92af22356a92e5706a5e9a53ec4e58af811a64e19b5e8841cd/clerk/javascript/issues/3563 |
| og:image:alt | 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | statico |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| go-import | github.com/clerk/javascript git https://github.com/clerk/javascript.git |
| octolytics-dimension-user_id | 49538330 |
| octolytics-dimension-user_login | clerk |
| octolytics-dimension-repository_id | 438331492 |
| octolytics-dimension-repository_nwo | clerk/javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 438331492 |
| octolytics-dimension-repository_network_root_nwo | clerk/javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width