- Symptom
- response.Body.toString() prints [object Object] or IncomingMessageTypeScript types Body as a union of Readable, ReadableStream and BlobJSON.parse fails on the object you just downloaded
- Cause
- In SDK v3 the Body is a runtime stream, not a Buffer as in v2. Later v3 releases attach helper methods to the stream that read it for you.
- Fix
- Await Body.transformToString() or transformToByteArray(). Read it once, because the stream is consumed by the first read.
- Apply
const res = await s3.send(new GetObjectCommand({ Bucket, Key })); const text = await res.Body.transformToString(); const data = JSON.parse(text);- Affected
- AWS SDK for JavaScript v3, @aws-sdk/client-s3 all versions; transformToString exists in releases from late 2022 onward
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders