Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
Hi, I have an Angular
application that I recently updated to version 19
, and during this migration I also updated aws-sdk/client-s3
to version 3.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
.
store(filename: string, data: Blob, folder: string): Promise<string> {
const weakThis = this;
return new Promise<string>(async (resolve, reject) => {
try {
const input: PutObjectRequest = {
ACL: 'public-read',
Bucket: this.awsBucket,
Key: `${folder}/${filename}`,
Body: data,
}
const command = new PutObjectCommand(input);
const resp = await weakThis.client.send(command);
if (resp.$metadata.httpStatusCode < 200 || resp.$metadata.httpStatusCode > 299) {
this.logger.error(`[AwsFileService][store] Error storing file at path ${key}`);
this.logger.error(`[AwsFileService][store] HTTP Status ${resp.$metadata.httpStatusCode}`);
reject(resp.$metadata.httpStatusCode);
return;
}
resolve(key);
} catch (error) {
debugger;
console.log(`[AwsFileService][store] Error storing file at path ${key}`);
this.logger.error(`[AwsFileService][store] Error storing file at path ${key}`);
console.log(`[AwsFileService][store] ${error}`);
this.logger.error(`[AwsFileService][store] ${error}`);
reject(error);
}
});
}
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 via ng 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
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/client-s3@3.731.1
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
22.12.0
Reproduction Steps
- Create a typical Angular 19 application
- Install aws-sdk/client-s3
- Add code above in description
- Test 1: run
ng serve
- Test 2: run
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 with ng serve
and ng build