nextjs - 💡(How to fix) Fix proxy.ts is not being invoked on Vercel when using basePath on nextjs 16.0.3 [4 comments, 3 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#86269Fetched 2026-04-08 02:11:46
View on GitHub
Comments
4
Participants
3
Timeline
12
Reactions
0
Timeline (top)
commented ×4labeled ×2closed ×1issue_type_added ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 23.9.0
  npm: 11.2.0
  Yarn: N/A
  pnpm: 10.6.0
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  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/nooraldarraji/basepath-proxy-bug

To Reproduce

  1. Add a basePath to next.config.ts
  2. Create a proxy file and a console log inside
  3. Deploy to Vercel (preview/prod)
  4. Navigate to the website (basePath) and then check the logs on Vercel resource: middleware

Current vs. Expected behavior

When you navigate to basePath (on Vercel only) you expect the website to run the proxy file based on the matcher, but nothing happens

PS: everything works fine in local dev server

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 23.9.0
  npm: 11.2.0
  Yarn: N/A
  pnpm: 10.6.0
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  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)

Vercel (Deployed)

Additional context

No response

extent analysis

TL;DR

  • The issue may be resolved by adjusting the basePath configuration in next.config.ts to ensure compatibility with Vercel's deployment environment.

Guidance

  • Review the next.config.ts file to ensure the basePath is correctly configured for deployment on Vercel.
  • Verify that the proxy file is properly set up and that the matcher is correctly defined to handle requests to the basePath.
  • Check Vercel's documentation for any specific requirements or restrictions on using basePath with middleware.
  • Test the application on a local development server with the same basePath configuration to isolate the issue.

Example

No code snippet is provided due to the lack of specific code details in the issue.

Notes

  • The issue seems to be specific to the Vercel deployment environment, as the application works fine on the local development server.
  • The exact cause of the issue is unclear without more information about the next.config.ts file and the proxy file configuration.

Recommendation

  • Apply workaround: Adjust the basePath configuration in next.config.ts to ensure compatibility with Vercel's deployment environment, as the issue seems to be related to the deployment stage.

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