From f74e0344958acc1d111235636d9c02ae6dd1305d Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Tue, 21 Apr 2026 22:16:08 +0000 Subject: [PATCH] fix(GRO-867): replace transformToBuffer with async iteration over S3 stream transformToBuffer() does not exist on StreamingBlobPayloadOutputTypes in the AWS SDK v3 client. Use for-await-of over the async iterable body to collect chunks and Buffer.concat instead. Co-Authored-By: Claude Opus 4.6 --- apps/api/src/lib/s3.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/api/src/lib/s3.ts b/apps/api/src/lib/s3.ts index 622ad68..5067101 100644 --- a/apps/api/src/lib/s3.ts +++ b/apps/api/src/lib/s3.ts @@ -77,7 +77,12 @@ export async function getObject(key: string): Promise<{ body: Buffer; contentTyp Key: key, }) ); - const body = await response.Body!.transformToBuffer(); + const chunks: Uint8Array[] = []; + // response.Body is a Readable stream; collect chunks into a buffer + for await (const chunk of response.Body as AsyncIterable) { + chunks.push(chunk); + } + const body = Buffer.concat(chunks); const contentType = response.ContentType ?? "application/octet-stream"; return { body, contentType }; }