You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observe that the method and headers of request 2 do not match those of request 1, even though request 2 was created by cloning request 1 (const req2 = new Request(req1))
Current vs. Expected behavior
Request 2 method and body should be the same as those of request 1.
Note this only happens for edge runtime. If, in the example below copied from the repro repository), I comment out the export const runtime = 'edge', the output is as expected.
Link to the code that reproduces this issue
https://github.com/dkokotov/nextjs-edge-request-cloning-bug
To Reproduce
const req2 = new Request(req1)
)Current vs. Expected behavior
Request 2 method and body should be the same as those of request 1.
Note this only happens for edge runtime. If, in the example below copied from the repro repository), I comment out the
export const runtime = 'edge'
, the output is as expected.Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 Binaries: Node: 20.8.0 npm: 10.1.0 Yarn: 1.22.19 pnpm: 8.7.5 Relevant Packages: next: 14.0.2-canary.5 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Middleware / Edge (API routes, runtime)
Additional context
Seems to only happen for running in dev mode. If I deploy the repro example to Vercel (https://nextjs-edge-request-cloning-bug.vercel.app), the output is as expected.
The text was updated successfully, but these errors were encountered: