aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.44k stars 2.13k forks source link

TypeError is thrown when Cognito is down #7286

Closed tncbbthositg closed 3 years ago

tncbbthositg commented 3 years ago

On 2020-11-25, AWS Cognito experienced an outtage.

Increased Error Rates 9:52 AM PST: The Kinesis Data Streams API is currently impaired in the US-EAST-1 Region. As a result customers are not able to write or read data published to Kinesis streams.

CloudWatch metrics and events are also affected, with elevated PutMetricData API error rates and some delayed metrics. While EC2 instances and connectivity remain healthy, some instances are experiencing delayed instance health metrics, but remain in a healthy state. AutoScaling is also experiencing delays in scaling time due to CloudWatch metric delays. For customers affected by this, we recommend manual scaling adjustments to AutoScaling groups.

The issue is also affecting other services, including ACM, Amplify Console, API Gateway, AppMesh, AppStream2, AppSync, Athena, Batch, CodeArtifact, CodeGuru Profiler, CodeGuru Reviewer, CloudFormation, CloudMap, CloudTrail, Cognito, Connect, DynamoDB, EventBridge, Glue, IoT Services, Lambda, LEX, Managed Blockchain, Marketplace, Personalize, RDS Performance Insights, Resource Groups, SageMaker, Support Console, Well Architected, and Workspaces. For further details on each of these services, please see the Personal Health Dashboard. Other services, like S3, remain unaffected by this event. This issue has also affected our ability to post updates to the Service Health Dashboard. We are continuing to work towards resolution.

10:47 AM PST: We continue to work towards recovery of the issue affecting the Kinesis Data Streams API in the US-EAST-1 Region. For Kinesis Data Streams, the issue is affecting the subsystem that is responsible for handling incoming requests. The team has identified the root cause and is working on resolving the issue affecting this subsystem.

The issue also affects other services, or parts of these services, that utilize Kinesis Data Streams within their workflows. While features of multiple services are impacted, some services have seen broader impact and service-specific impact details are below.

Our users received an error message that read:

undefined is not an object (evaluating '(t.__type||t.code).split')

The stack trace I was able to get at the time was as follows:

TypeError: Cannot read property 'split' of undefined
    at Client.js:98
    at tryCallOne (core.js:37)
    at core.js:123
    at JSTimers.js:274
    at _callTimer (JSTimers.js:130)
    at _callImmediatesPass (JSTimers.js:181)
    at MessageQueue.callImmediates [as _immediatesCallback] (JSTimers.js:441)
    at MessageQueue.__callImmediates (MessageQueue.js:387)
    at MessageQueue.js:135
    at MessageQueue.__guard (MessageQueue.js:364)

By the time I started looking into it, authentication was beginning to work more reliably so reproducing the issue became effortful.

In any case, I think this may be the culprit: https://github.com/aws-amplify/amplify-js/blob/ba8a73f41db6411b91b208fea3202408c55f029b/packages/amazon-cognito-identity-js/src/Client.js#L98

It might be worth checking to see if data.__type or data.code resolve before trying to .split('#') them. Based on the context, it's possible that we'd like to throw a network error:

throw new Error('Network error');
sammartinez commented 3 years ago

This is a known issue, I am going to mark this issue as a duplicate in favor of #7284. Please follow this issue, thanks!

github-actions[bot] commented 2 years ago

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 *-help channels or Discussions for those types of questions.