-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expo/JavaScript client fails in strange ways with poor or no network connectivity #3563
Comments
Hey, This is also happening to us on any type of login action (oauth google/apple and sign in through email)
It only seems to happen on Andriod from time to time. We did manage to fix it on some in-house testing devices by erasing all cache and deleting all data before reinstalling the app, this is not acceptable since we can't find a way to seamlessly catch or automate that for the end user. As a side note, we observe a warning at the app startup
Maybe it is related to this? Our app is |
FWIW, our workaround is to catch this these types of errors and propagate them to the user. For example, try {
setLoading.on()
const { createdSessionId, setActive } = await startOAuthFlow()
if (createdSessionId) {
setActive?.({ session: createdSessionId })
}
} catch (err) {
const message = extractClerkErrors(err)
if (/Cannot read property 'toString' of null/.test(message)) {
log.warn(`Probable network failure: to-String-of-null error during OAuth sign-in`)
Alert.alert(
"Oops!",
`We couldn't sign you in, likely due to a network error. Please check your network connection and try again.\n\nIf you're still having trouble, please email us at [email protected]`,
)
return
}
log.error("error starting oauth flow for %s: %s", strategy, message)
Alert.alert("Sign In Error", message)
} finally {
setLoading.off()
}
// elsewhere...
export const extractClerkErrors = (error: any) => {
if (error?.errors) {
return (
"Error: " +
error.errors.map((e: any) => e.longMessage ?? e.message).join(", ")
)
} else {
return "Error: " + (error?.message ?? String(error))
}
} |
Preliminary Checks
Reproduction
https://github.com/statico/repro-clerk-connectivity
Publishable key
pk_test_Y2xlcmsuaW5zcGlyZWQubGlvbmZpc2gtMzgubGNsLmRldiQ
Description
Steps to reproduce:
Prerequisites:
pnpm install
.env
file withCLERK_PUBLISHABLE_KEY=
pnpm start
and then hiti
ora
to open the app in iOS or AndroidBug No. 1
Bug No. 2
[email protected]
, and click "Sign In"[email protected]
, and click "Sign In"Expected behavior:
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.Thanks, Clerk team!
Environment
The text was updated successfully, but these errors were encountered: