Skip to content

Commit d108359

Browse files
vicbconico974
andcommitted
fix(cloudflare): fix the node wrapper
Returns the response converted from the internal event. It fixes a "This ReadableStream did not return bytes" workerd error. Co-authored-by: conico974 <nicodorseuil@yahoo.fr>
1 parent 5eb848f commit d108359

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/giant-parrots-hear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/aws": patch
3+
---
4+
5+
fix(cloudflare): fix the node wrapper

packages/open-next/src/overrides/wrappers/cloudflare-node.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ const handler: WrapperHandler<InternalEvent, InternalResult> =
5050
responseHeaders.append("Set-Cookie", cookie);
5151
}
5252

53-
const { readable, writable } = new TransformStream();
53+
const { readable, writable } = new TransformStream({
54+
transform(chunk, controller) {
55+
controller.enqueue(Uint8Array.from(chunk.chunk ?? chunk));
56+
},
57+
});
5458
const response = new Response(readable, {
5559
status: statusCode,
5660
headers: responseHeaders,

0 commit comments

Comments
 (0)