aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.12k stars 578 forks source link

@aws-sdk/client-cognito-identity-provider TypeError: stream.arrayBuffer is not a function (it is undefined) #6636

Open JulianHillworth opened 5 days ago

JulianHillworth commented 5 days ago

Checkboxes for prior research

Describe the bug

Using package @aws-sdk/client-cognito-identity-provider in a react native application.

Currently on version 3.654.0, all commands work with nil issues.

Patched to 3.686.0 which seems to be a breaking change on multiple commands. Two that I have tested are GetUserCommand and ConfirmForgotPasswordCommand.

I get breaking error

[TypeError: stream.arrayBuffer is not a function (it is undefined) Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.]

Revert to 3.654.0 and all commands work again, nil issues.

Regression Issue

SDK version number

@aws-sdk/client-cognito-identity-provider@3.686.0

Which JavaScript Runtime is this issue in?

React Native

Details of the browser/Node.js/ReactNative version

0.74.5

Reproduction Steps

export const confirmForgotPassword = async (
  username: string,
  confirmationCode: string,
  newPassword: string
) => {
  try {
    const input = {
      ClientId: USER_POOL_WEB_CLIENT_ID,
      Username: username,
      ConfirmationCode: confirmationCode,
      Password: newPassword,
    };

    const command = new ConfirmForgotPasswordCommand(input);
    const response = await cognitoClient.send(command);

    return response;
  } catch (error) {
    console.error(`confirmForgotPassword error: `, error);
  }
};``

and the other one

const handleGetUserCommand = async (accessToken: string) => {
  try {
    const command = new GetUserCommand({
      AccessToken: accessToken,
    });
    const response = await cognitoClient.send(command);
    return response;
  } catch (error) {
    console.log(`handleGetUserCommand error: `, error);
    return null;
  }
};

Observed Behavior

Nil changes to code but when patched get the following breaking error

[TypeError: stream.arrayBuffer is not a function (it is undefined) Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.]

Expected Behavior

Not break

Possible Solution

No response

Additional Information/Context

No response

kuhe commented 4 days ago

Try adding a polyfill for Blob.arrayBuffer().

smritiBuilder commented 20 hours ago

ERROR error: [TypeError: stream.arrayBuffer is not a function. (In 'stream.arrayBuffer()', 'stream.arrayBuffer' is undefined) Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.].
with this version "@aws-sdk/client-s3" :"3.609.0", Reactnative version: 66.5 Stuck in the uploading Ascii file to S3 bucket, after upgrade to SDK 34 android. Already tried Blob.arrayBuffer(). Doesnot worked. Kindly suggest!!