aws-sdk-js-v3: TypeError: Invalid RFC-3339 date-time value when sending AssumeRoleWithWebIdentityCommand

Describe the bug

Got error TypeError: Invalid RFC-3339 date-time value when sending command AssumeRoleWithWebIdentityCommand from STSClient . The network request itself is successful by checking the network debug tool in chrome. The error happens when the SDK trying to deserialize credentials expiration date from the http response.

Your environment

React web application that deployed to AWS S3 and using the endpoint created by AWS Cloudfront. The web identity endpoint we are using is https://midway-auth.amazon.com/SSO

SDK version number

@aws-sdk/client-sts@3.34.0

Is the issue in the browser/Node.js/ReactNative?

Browser

Details of the browser/Node.js/ReactNative version

npx: installed 1 in 1.532s

Browsers: Chrome: 94.0.4606.71

Steps to reproduce

    const client = new STSClient({ region: 'us-west-2' });
    const command = new AssumeRoleWithWebIdentityCommand({
        RoleArn: DASHBOARD_ROLE_ARN,
        RoleSessionName: `${SESSION_PREFIX}${Date.now()}`,
        WebIdentityToken: token
    });
    client.send(command)
        .then(data => onAssumeRoleSuccessful(data, callback))
        .catch(error => callback(error));

Observed behavior

Once we have the web identity token. we are executing the above code in order to get the credentials. Due to the above code snippet, the error will be caught and used as the argument in the callback function. In callback function, we print the error out. See screenshot below.

Expected behavior

We should not get this error at all. Just an FYI, if we downgrade to SDK v2 and this issue will just gone.

Screenshots

If applicable, add screenshots to help explain your problem. Screen Shot 2021-10-02 at 12 51 20 AM

Additional context

Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 27 (2 by maintainers)

Most upvoted comments

@slimandslam i tried 3.40 right now (for S3Client) but the issue still persists