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)
@andriworld Multiple AWS services are down
https://www.reddit.com/r/aws/comments/k0sd0l/cloudwatch_useast1_problems_again/
Glad I'm not the only one, I reported this here as well hoping it wasn't just me! Where do you see the multiple AWS services down? I only see Kineses and now Cloudwatch.
@Shadrack1701 here you can see all the services affected
https://status.aws.amazon.com/
7:30 AM PST: Kinesis is experiencing increased API errors in the US-EAST-1 Region. This is also causing issues with Cognito, IoT Core, EventBridge and CloudWatch. This issue has also affected our ability to post updates to the Service Health Dashboard.
An AWS service outage definitely seems to be the culprit. Removing the 'URGENT' text from this issue's title.
I just wanted to chime in here and say that depending on your version and/or config you may see other errors which have the same underlying cause. In our app (both dev and prod versions) we're seeing this error from the library when attempting to refresh credentials with Cognito in us-east-1: undefined is not an object (evaluating '(t.__type||t.code).split')
@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.
@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#L98If 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.
No worries! Apologizes on closing this issue as well, usually when I reference an issue it gives insight to other issues that come up when these issues arise. I believe we can leave the other issue closed and have this callout live here in case this occurs again. Thanks for the feedback !
The Cognito outage seems to have fully recovered. I am no longer seeing authentication issues, service latencies, CORS errors, or strange credential responses using Amplify JS.
From AWS service health dashboard:
"2:43 PM PST Between 5:15 AM and 2:28 PM PST customers experienced increased API failure rates for Cognito User Pools and Identity Pools in the US-EAST-1 Region. This was due to an issue with Kinesis Data Streams. We have implemented a mitigation to this issue. Cognito is now operating normally."
Resolving this issue as services have been restored. Please let us know if you are still experiencing issues. thanks!
Most helpful comment
@andriworld Multiple AWS services are down
https://www.reddit.com/r/aws/comments/k0sd0l/cloudwatch_useast1_problems_again/