Recently I faced a problem with AWS Cogntio JS SDK V3 for S3 buckets. While calling PutObjectCommand from SDK, an error occurs with the message TypeError: readableStream.getReader is not a function.

On googling the error, I found this GitHub thread Angular 19 PutObjectRequest readableStream.getReader is not a function, where repo maintainers confirmed that the issue is known and work is in progress to fix it. However, a user named aBurmeseDev shared a quick workaround also that I’m going to share in this post.
Solution TypeError: readableStream.getReader is not a function
While constructing client for S3, make use to add parameter requestChecksumCalculation: “WHEN_REQUIRED” as shown in the code below:-
const putFileToS3 = async (file, fileName, idToken) => {
const config = { region: import.meta.env.VITE_AWS_REGION, requestChecksumCalculation: "WHEN_REQUIRED" }
config.credentials = await getIAMCreds(idToken);
const s3Client = new S3Client(config);
const input = {
Bucket: s3BucketName,
Key: fileName,
Body: file,
ContentType: file.type,
};
const command = new PutObjectCommand(input);
const response = await s3Client.send(command);
console.log(response);
return response.$metadata.httpStatusCode === 200;
}
Checkout solution and progress on Github:- https://github.com/aws/aws-sdk-js-v3/issues/6834#issuecomment-2613306914
Hope the solution helped you! Thanks 🙂