Some fetch operations fail with testProxy enabled
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/dustinsoftware/next-testmode-issue-repro
To Reproduce
USE_TEST_PROXY=1 BUCKET_NAME=bucket-name npm run dev
Current vs. Expected behavior
Having the testProxy mode enabled in next config results in some fetch operations failing when the app is run in dev mode and in standalone mode. This is similar to https://github.com/vercel/next.js/issues/66238
Impacted fetch calls fail with the following stack:
{"level":50,"time":1755810957931,"pid":10975,"hostname":"xxx","name":"console","err":{"type":"TypeError","message":"fetch failed: expect header not supported","stack":"TypeError: fetch failed\n at node:internal/deps/undici/undici:13510:13\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async /Users/dustin.masters/Code/next-aws-sdk-minimal-repro/.next/standalone/node_modules/next/dist/experimental/testmode/httpget.js:16:26\n at async s.push.done (/Users/dustin.masters/Code/next-aws-sdk-minimal-repro/.next/standalone/node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js:1:15030)\ncaused by: NotSupportedError: expect header not supported\n at processHeader (node:internal/deps/undici/undici:2174:15)\n at new Request (node:internal/deps/undici/undici:1998:15)\n at [dispatch] (node:internal/deps/undici/undici:7802:25)\n at Intercept (node:internal/deps/undici/undici:7535:20)\n at [Intercepted Dispatch] (node:internal/deps/undici/undici:572:16)\n at Client.dispatch (node:internal/deps/undici/undici:588:44)\n at [dispatch] (node:internal/deps/undici/undici:819:32)\n at [Intercepted Dispatch] (node:internal/deps/undici/undici:565:33)\n at Pool.dispatch (node:internal/deps/undici/undici:588:44)\n at [dispatch] (node:internal/deps/undici/undici:8230:27)","$metadata":{"attempts":1,"totalRetryDelay":0}},"msg":"fetch failed"}
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
Available memory (MB): 131072
Available CPU cores: 16
Binaries:
Node: 22.16.0
npm: 10.9.2
Yarn: 4.9.1-git.20250411.hash-1908ee79f
pnpm: N/A
Relevant Packages:
next: 15.5.1-canary.3 // Latest available version is detected (15.5.1-canary.3).
eslint-config-next: N/A
react: 19.1.0
react-dom: 19.1.0
typescript: 5.9.2
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local), next build (local)
Additional context
There is a detailed readme in the repo with some more background.
We have a workaround (use an env var to control testProxy) but it was surprising to me that requests made not during a playwright run are impacted.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked reproduction with USE_TEST_PROXY=1 and inspect the fetch path shown in .next/standalone/node_modules/next/dist/experimental/testmode/httpget.js, along with the compiled @mswjs/interceptors ClientRequest stack. Confirm the failure in next dev and standalone mode, then verify that fetches succeed outside Playwright while testProxy remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, node.js
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100