diff --git a/packages/middleware-sdk-s3/src/throw-200-exceptions.ts b/packages/middleware-sdk-s3/src/throw-200-exceptions.ts index 487438c3b54b..ccef9b8910fa 100644 --- a/packages/middleware-sdk-s3/src/throw-200-exceptions.ts +++ b/packages/middleware-sdk-s3/src/throw-200-exceptions.ts @@ -48,6 +48,15 @@ export const throw200ExceptionsMiddleware = return result; } + const isSplittableStream = + typeof sourceBody?.stream === "function" || + typeof sourceBody?.pipe === "function" || + typeof sourceBody?.tee === "function"; + + if (!isSplittableStream) { + return result; + } + let bodyCopy = sourceBody; let body = sourceBody;