-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular 19 PutObjectRequest readableStream.getReader is not a function #6834
Comments
+1 I have faced this issue and reverted back my package version to After debugging, I realized that it's dues to https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.729.0 minor version update. As it's breaking the flow, anyone please provide steps or configuration to avoid this issue. |
Thank you for replying! While the latest version of the SDK is still broken, you pointing me to version |
The latests stable version where it works is Starts failing starting release 3.729.0 I thinks could be on this commit b6204f8 Code example putting an object to the bucket:
Error message:
|
Hi @mike-appvision - thanks for reaching out and for your patience while we look into it. I noticed you mentioned files were uploaded successfully on Test 1 and failed on Test 2. Could you elaborate on that? During my attempt to replicate the issue, I was able to reproduce the error in first few uploads and then it started to upload successfully. Here's my repro for reference: https://github.com/aBurmeseDev/aws-sdk-js-s3-angular In the meantime, here are a few workarounds we'd like to suggest here:
const client = new S3({
...
requestChecksumCalculation: "WHEN_REQUIRED",
...
});
const fileArrayBuffer = await file.arrayBuffer(); // Convert File to ArrayBuffer
const command = new PutObjectCommand({
Bucket: 'Bucket_Name',
Key: file.name,
Body: new Uint8Array(fileArrayBuffer), // Convert ArrayBuffer to Uint8Array
ContentType: file.type,
});
|
This is happening with file uploads, since requestBody is a File object in flexible checksums middleware. aws-sdk-js-v3/packages/middleware-flexible-checksums/src/flexibleChecksumsMiddleware.ts Line 122 in 9f9fe77
The implementation expects it to be ReadableStream. |
As @aBurmeseDev mentioned, the simplest workaround at the time of comment is to disable checksum computation by setting the following configuration during client creation const client = new S3({
// ... other params
// ToDo: Remove workaround once https://github.com/aws/aws-sdk-js-v3/issues/6834 is fixed.
requestChecksumCalculation: "WHEN_REQUIRED",
}); If the files are not huge, you can convert them to ArrayBuffer too. // ...
await client.putObject({
Bucket: import.meta.env.VITE_AWS_S3_BUCKET_NAME,
Key: file.name,
Body: await file.arrayBuffer(),
});
// ... I'll raise this issue internally with the team on Mon, Jan 27th, and provide an update. |
Checkboxes for prior research
Describe the bug
Hi, I have an
Angular
application that I recently updated to version19
, and during this migration I also updatedaws-sdk/client-s3
to version3.731.1
.Before the migration the following code worked fine allowing me to upload files to S3. However, now the same code throws the exception
TypeError: readableStream.getReader is not a function
.Interestingly when I run the Angular application via
ng serve
this code works as expected. However, when I attempt to build a production copy of the application viang build
, and then run as a standard Node JS application that the issue occurs.Environment:
Node.js: 22.12.0
Angular: 19.1.2
TypeScript: 5.7.3
aws-sdk/client-s3: 3.731.1"
Regression Issue
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
22.12.0
Reproduction Steps
ng serve
ng build
Observed Behavior
Test 1: File uploads successfully
Test 2: Exception is thrown.
Expected Behavior
Test 1: File uploads successfully
Test 2: File uploads successfully
Possible Solution
No response
Additional Information/Context
No response
UPDATE
I am thinking the original
Test 1
scenario is not valid. Since posting this I changed the version of aws-sdk/client-s3 back to 3.32.0 (last known working version), and now I'm able to replicate the issue regardless of how the app is built. I have switched back to 3.731.1 and am able to replicate the issue both withng serve
andng build
The text was updated successfully, but these errors were encountered: