Skip to content

Commit

Permalink
fix(remix): Fix issue of creating multiple branches of a single strea…
Browse files Browse the repository at this point in the history
…m on Cloudflare Workers (#2953)
  • Loading branch information
octoper authored Mar 7, 2024
1 parent 141f09f commit 3a0eacd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/shiny-ties-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/remix': patch
---

Replace `response.clone()` with `new Response(response.body, response)` to avoid creating multiple branches of a single stream on Cloudflare workers ([issue reference](https://github.com/cloudflare/workers-sdk/issues/3259)).
2 changes: 1 addition & 1 deletion packages/remix/src/ssr/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const injectRequestStateIntoResponse = async (
requestState: RequestState,
context: AppLoadContext,
) => {
const clone = response.clone();
const clone = new Response(response.body, response);
const data = await clone.json();

const { clerkState, headers } = getResponseClerkState(requestState, context);
Expand Down

0 comments on commit 3a0eacd

Please sign in to comment.