nextjs - 💡(How to fix) Fix Next 16.0: Route segment config is not allowed in Proxy file [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85242Fetched 2026-04-08 02:16:53
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
1
Author
Timeline (top)
commented ×2labeled ×2closed ×1issue_type_added ×1

Error Message

Build error occurred Error: Route segment config is not allowed in Proxy file at "./proxy.ts". Proxy always runs on Node.js runtime. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy

Code Example

Build error occurred
Error: Route segment config is not allowed in Proxy file at "./proxy.ts". Proxy always runs on Node.js runtime. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:35:32 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 12
Binaries:
  Node: 22.21.0
  npm: 10.9.4
  Yarn: 1.22.22
  pnpm: 10.15.1
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Gomah/next-16-proxy-runtime

To Reproduce

  1. Install the dependencies: npm install
  2. Build the app: npm run build
  3. Build error occurs:
Build error occurred
Error: Route segment config is not allowed in Proxy file at "./proxy.ts". Proxy always runs on Node.js runtime. Learn more: https://nextjs.org/docs/messages/middleware-to-proxy

Current vs. Expected behavior

The build fails with an error stating "Proxy always runs on Node.js runtime." However, the documentation indicates that Proxy (middleware) defaults to the Edge Runtime:

Middleware to Proxy migration guide Proxy API reference

Expected: Build should pass without errors. Actual: Build fails due to conflicting runtime requirements.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:35:32 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 12
Binaries:
  Node: 22.21.0
  npm: 10.9.4
  Yarn: 1.22.22
  pnpm: 10.15.1
Relevant Packages:
  next: 16.0.0 // Latest available version is detected (16.0.0).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Middleware

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

There appears to be a discrepancy between the error message claiming Proxy runs on Node.js runtime and the documentation stating it defaults to Edge Runtime

extent analysis

TL;DR

  • The build error can likely be resolved by updating the proxy.ts file to be compatible with the Edge Runtime, as indicated by the Next.js documentation.

Guidance

  • Review the Middleware to Proxy migration guide to understand the requirements for Proxy files in Next.js.
  • Verify that the proxy.ts file does not contain any route segment configurations, which are not allowed in Proxy files.
  • Check the Next.js version and ensure that it is up-to-date, as the issue might be related to a version mismatch.
  • Consider testing the build process with a minimal proxy.ts file to isolate the issue and identify any specific configurations that might be causing the error.

Example

No specific code example can be provided without modifying the original code, but reviewing the proxy.ts file for any route segment configurations and ensuring compatibility with the Edge Runtime is a good starting point.

Notes

The discrepancy between the error message and the documentation suggests that there might be a version-specific issue or a misunderstanding of the Proxy configuration requirements. Further investigation into the Next.js version and the proxy.ts file configuration is necessary to resolve the issue.

Recommendation

  • Apply workaround: Update the proxy.ts file to be compatible with the Edge Runtime, and review the Next.js documentation to ensure that the configuration meets the requirements for Proxy files. This approach is recommended because it allows for a targeted fix without requiring a version upgrade, which might not be feasible in all environments.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING