aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client
Apache License 2.0
114 stars 65 forks source link

[Bug]: CWR: Failed to retrieve Cognito OpenId token: TypeError: Failed to fetch #550

Closed ShawneeY closed 1 month ago

ShawneeY commented 1 month ago

Which web client version did you detect this bug with?

v1.17.0

What environment (build systems, module system, and framework) did you detect this bug with?

Build: WebPack: 4.30.0 Module system: ESmodules Framework: React 18.2.0

Is your web application a single page application (SPA) or multi page application (MPA)?

SPA

Please provide your web client configuration

{
  "applicationId":"28bcd758-d73e-4dcc-819c-8b8c7b884f6f",
  "applicationVersion":"1.0.0",
  "applicationRegion":"us-east-1",
  "config":{
    "sessionSampleRate":1,
    "sessionEventLimit":0,
    "allowCookies":true,
    "enableXRay":true,
    "telemetries":[
      "performance",
      "errors",
      "http"
    ],
    "disableAutoPageView":true,
    "guestRoleArn":"arn:aws:iam::436564937965:role/RUM-Monitor-us-east-1-436564937965-0146366218071-Unauth",
    "identityPoolId":"us-east-1:24100b6d-6930-4ce8-97dd-85e02e091454",
    "endpoint":"https://dataplane.rum.us-east-1.amazonaws.com"
  }
}

Please describe the bug/issue

Seen intermediate errors happening every day(~150 error event per week with 100% sampling rate):

event_details.message CWR: Failed to retrieve Cognito OpenId token: TypeError: Failed to fetch

Error: CWR: Failed to retrieve Cognito OpenId token: TypeError: Failed to fetch at CognitoIdentityClient. (https://dcupkcmoyuvm5.cloudfront.net/vendor-433a82d03bb6cbd1d56a.js:62:40138) at step (https://dcupkcmoyuvm5.cloudfront.net/vendor-433a82d03bb6cbd1d56a.js:62:38657) at Object.throw (https://dcupkcmoyuvm5.cloudfront.net/vendor-433a82d03bb6cbd1d56a.js:62:38763) at rejected (https://dcupkcmoyuvm5.cloudfront.net/vendor-433a82d03bb6cbd1d56a.js:62:37449)

Please help root cause ?

williazz commented 1 month ago

Are these errors being recorded as RUM JSErrors? If so, then there may be availability drops in the call to Cognito that eventually succeed on retries. After which, your web client is successfully able to call PutRumEvents.

I would recommend ignoring JSErrors that match this message pattern to cleanup your dashboards.

adebayor123 commented 1 month ago

As @williazz stated, ignoring these errors would help clean up your RUM dashboard. Otherwise, this seems to be a transient issue coming from browser cache.