next-on-pages icon indicating copy to clipboard operation
next-on-pages copied to clipboard

Remove the `cache` property from calls to `new Request(...)` in React

Open james-elicx opened this issue 3 months ago • 7 comments

In the React server code, there is a ternary where they create a new Request object and forward all properties on RequestInit to it. This won't work in workerd due to the cache property being present. Therefore, we need to overwrite their ternary with a way for us to strip the cache property from the RequestInit object.

https://github.com/vercel/next.js/blob/9ec37c12/packages/next/src/compiled/react/cjs/react.react-server.production.js#L87

Additionally, once this patch has been added, it looks like the error can then happen in our patched fetch. Therefore, also adding similar logic there to strip out the cache property from the RequestInit object.

fixes #719

james-elicx avatar May 04 '24 21:05 james-elicx