Remix Cloudflare Pages - Your worker called response.clone() #6540
Open
Description
What version of Remix are you using?
Remix 1.16.1 and Wrangler version 3.0.1
Are all your remix dependencies & dev-dependencies using the same version?
- Yes
Steps to Reproduce
Setup project using Remix Cloudflare Pages Template
Then upgrade Wrangler package from 2.7.0 to 3.0.1
Expected Behavior
Should not log any warnings to the console
Actual Behavior
When using wrangler (powered by Miniflare and workerd), I get the following warning logged to the console when executing any actions:
Your worker called response.clone(), but did not read the body of both clones.
This is wasteful, as it forces the system to buffer the entire response body in
memory, rather than streaming it through.
This may cause your worker to be unexpectedly terminated for going over
the memory limit. If you only meant to copy the response headers and
metadata (e.g. in order to be able to modify them), use
`new Response(response.body, response)` instead.
Could track it down to this section of the code:
remix/packages/remix-cloudflare-pages/worker.ts
Lines 57 to 60 in 880ab96
Should be replaced with
response = await context.env.ASSETS.fetch(
context.request.url,
new Response(response.body, response)
);