question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auth.currentCredentials outage - CORS headers missing

See original GitHub issue

Describe the bug Starting today, Auth.currentCredentials() fails consistently with a CORS error.

This took down my production site. I imagine this issue might be from an AWS service rather than Amplify. Could you please help me route it to the correct contact?

To Reproduce

try {
     credentials = await Auth.currentCredentials()
 } catch (err) {
      console.error("Failed to get credentials: ", err);
 }

Observation The call hangs for about 10 seconds, then returns this object: credentials: {"$metadata":{"attempts":1,"totalRetryDelay":0}}

Javascript log (Chrome) Access to fetch at 'https://cognito-identity.us-east-1.amazonaws.com/' from origin '[...]' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Expected The credentials object should be populated with the credentials (identityId, etc)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
iyz91commented, Nov 25, 2020
1reaction
tncbbthositgcommented, Nov 25, 2020

@sammartinez, you closed the issue @lafiosca and I mentioned. I just wanted to make sure that the information isn’t lost.

When an outage like this happens, we get a type error because there needs to be a guard in place to prevent evaluating methods on undefined. That way, we can provide our users with more meaningful errors.

Will this card address the defect on this line: https://github.com/aws-amplify/amplify-js/blob/ba8a73f41db6411b91b208fea3202408c55f029b/packages/amazon-cognito-identity-js/src/Client.js#L98

If not, can we re-open #7286 or create a new issue to account for this change? I know this is kind of trivial, but I think that consumers of a library should be able to count on the library guarding against runtime errors like this.

Thanks!!

Edit: I just re-read this and realized that it may not come across as positively as I intended, but I couldn’t figure out how to address the ambiguous tone. Please know that I appreciate your efforts very much and this is not meant to be argumentative or critical.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amplify: CORS header 'Access-Control-Allow-Origin' missing ...
When I invoke my API using Amplify: let myInit = { headers: { Authorization: `Bearer ${(await Auth.currentSession()) .
Read more >
Possible to set current credentials manually? #825 - GitHub
I have a custom login using the authorize and token endpoints (custom login interface), and wish to load the credentials in the Auth...
Read more >
AWS-Amplify/Lobby - Gitter
I entered amplify push after adding an auth service using cognito. ... currentCredentials(), // Amazon Cognito user pools using AWS Amplify // type: ......
Read more >
Troubleshooting online endpoints deployment and scoring
Learn how to troubleshoot some common deployment and scoring errors with online endpoints.
Read more >
How do I resolve a CORS error for my API Gateway REST API?
We appreciate your feedback: https://amazonintna.qualtrics.com/jfe/form/SV_a5xC6bFzTcMv35sSkip directly to the demo: 0:40For more details ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found