[expo] Android: useAuth().isLoaded never resolves on cold start when Wi-Fi already connected (native connectivity monitor hang)
@wobsoriano ci sta già lavorando.
Dal 23/6/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Summary
On a real Android device, @clerk/expo's useAuth().isLoaded never becomes true on a cold start when the device is already connected to Wi‑Fi, so any gate like if (!isLoaded) return <Spinner/> spins forever. The device network is completely healthy. Toggling Wi‑Fi off/on while it's stuck immediately unblocks it and the app proceeds. It does not reproduce on the Android emulator (its network state flickers during boot), which makes it easy to miss in QA but it hits real users.
This looks like the native clerk-android connectivity monitor waiting for a ConnectivityManager onAvailable callback that never fires for a network that was already available before the callback was registered (i.e. every normal cold start on stable Wi‑Fi).
Environment
@clerk/expo |
3.5.2 (also repro'd intent on 3.4.3; canary 3.5.3 unchanged) |
| native | com.clerk:clerk-android-api / -ui 1.0.28 (also 1.0.30) |
| Expo SDK | 56 (New Architecture / bridgeless, React 19, RN 0.85.3) |
| Device | Samsung Galaxy Z Fold 3 (SM‑F926B), real device, stable Wi‑Fi |
| Clerk instance | development (pk_test_…) |
| Build | EAS preview (release-style standalone) |
Steps to reproduce
@clerk/expowith a standard<ClerkProvider publishableKey tokenCache>and anisLoadedgate (e.g. expo-router group layout returns a spinner while!isLoaded).- Build a release/standalone Android build, install on a real device on stable Wi‑Fi.
- Cold-launch the app (let Wi‑Fi settle first; don't toggle anything).
Actual: stuck on the loading state forever; isLoaded stays false.
Expected: isLoaded resolves (network is reachable) and the app proceeds, as it does on web/emulator.
Workaround that proves the cause: while stuck, toggle Wi‑Fi (or airplane mode) off→on. isLoaded resolves within ~1s and the app proceeds. Verified via adb shell svc wifi disable && svc wifi enable.
Evidence the network is fine
From the same device, while the app is hung:
# DNS + HTTPS to the Frontend API, x3
$ adb shell curl -s -m 12 -o /dev/null -w '%{http_code} %{time_total}s' \
'https://<instance>.clerk.accounts.dev/v1/environment?_clerk_js_version=5'
200 1.07s
200 0.62s
200 0.62s
DNS resolves, TLS connects, ping to the Clerk CDN ~7ms, Private DNS off, device clock correct.
Relevant logcat (cold start, app pid)
ReactNativeJS: Running "main"
ReactNativeJS: Clerk: Clerk has been loaded with development keys...
ConnectivityManager: registerNetworkCallback(...)
com.clerk.api.configuration.connectivity.NetworkConnectivityMonitor.configure(...)
com.clerk.api.configuration.ConfigurationManager.configure(...)
com.clerk.api.Clerk.initialize(...)
expo.modules.clerk.ClerkExpoModule$configure$1.invokeSuspend(ClerkExpoModule.kt:124)
…then nothing further — init never completes, so isLoaded never flips. After a Wi‑Fi toggle, init completes and the sign-in screen renders.
Things we tried (that did NOT fix it)
__experimental_resourceCache(offline-support): no change on a clean install — it only helps once a successful load has seeded the cache, but the initial load is exactly what hangs, so the cache never seeds.- Excluding the native module to run JS-only (
expo.autolinking.android.exclude: ["@clerk/expo"]): crashes withError: Cannot find native module 'ClerkExpo'becausedist/specs/NativeClerkModule.android.jscallsrequireNativeModule("ClerkExpo")at module-eval (top level, no try/catch), so importing@clerk/expothrows when the native module is absent. (Separately: a top-levelrequireNativeModulewith no graceful fallback seems risky.) - Upgrading to canary
3.5.3/ native1.0.30— sameclerk-android1.0.28-era connectivity code, no change.
Likely root cause / suggested fix
The native connectivity monitor appears to gate initialization on a network‑availability event rather than reading the current network synchronously. On a cold start where the network is already connected, registerNetworkCallback's onAvailable may not fire (it fires for networks that become available after registration), so init waits indefinitely. Reading the active network at registration time (e.g. ConnectivityManager.getActiveNetwork() / registerDefaultNetworkCallback, or seeding the initial online state) — and/or adding a timeout so init resolves even if the monitor never reports — would fix the cold-start hang.
Happy to provide a minimal repro or more logs. Thanks!
- Lingua principale
- TypeScript
- Stelle
- 1.8k
- Fork
- 472
- Merge medio
- 2g 10h
- PR unite (30g)
- 215
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di clerk/javascript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
clerk/javascript#9611 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
clerk/javascript#9573 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 64/100
clerk/javascript#9775 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
clerk/javascript#9770 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
clerk/javascript#9667 · 1 commento ·
Tutte le issue di clerk/javascript
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·