Bugfix: Fix #15004 by applying MDN recommended fix when proxying Response in page_load #15005
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Node v24+, the undici library used for HTTP has a Response class with a private element. Proxying the response therefore fails when calling clone() as the method returned by the proxy cannot access the private state element.
In the linked issue, I mention the MDN version of this fix using a simple
function (...any) { ... }but I opted for the slightly more comprehensive one usingReflect.apply()andObject.defineProperties()as it ensures the returned function is identical to introspection (according to nodejs/undici#4290 (comment), anyway).See: #15004.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
I included a page in the test apps that reproduces the error (only on Node v24+, obviously). You can reproduce this error by visiting this test page with the fix from this PR reverted.
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits