-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
"No internet connexion" case not handled in amazon-cognito-identity-js ? #558
Comments
Hello jimshell - I am also stuck with this same issue ! Any luck on solution ? |
Hello saxenankit123, I have not tried to find any temporary workaround for this, I'm confident that the AWS/Amplify Team will sort this out quickly :) The only thing I can think of at the moment would be to use a timeout wrapper around the signin call, and consider it "failed due to network" if it does not complete within the given time range (could be 10, 15, 30s... 10s is already pretty long in my opinion) But again, please give the AWS/Amplify Team some time to address this issue properly ;) Cheers, |
I believe this is related and should get merged soon: |
Excellent! Thank you! :) |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Hi,
Using Amplify Auth to sign users in, I've just run a few tests with no internet connexion (by setting Chrome to "offline"), and I noticed that the promise on Auth.signIn was not rejected properly, so catch() was never fired.
I had a proper look at the error in console:
OPTIONS https://cognito-idp.eu-central-1.amazonaws.com/ net::ERR_INTERNET_DISCONNECTED
Uncaught (in promise) TypeError: Cannot read property 'headers' of undefined
The second error shows that in Client.js, the fetch catch does not handle the possibility of no headers at all =>
var code = (response.headers.get('x-amzn-errortype') || 'UnknownError').split(':')[0];
chokes on this one, and never calls the callback with an error.
Which then does not reject the signIn promise (or any other promise for any other method that relies on this)
I assume that Client.js should check that headers are indeed received first, and if not, callback an error, so that promise based code can later handle the "No internet connection" properly. The signIn call currently fails silently, which is not good in terms of UX...
Thank you!
The text was updated successfully, but these errors were encountered: