vercel / vercel/next.js

Catch-all route also intercepts and catches static assets and js chunks

Open
#73,028 3 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Linking and Navigating Runtime
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/r6203/next-catch-all-bug

To Reproduce
  1. Create a catch-all route
  2. run next dev
  3. go to any static route or js chunk or view server logs to see chunks intercepted
Current vs. Expected behavior

Having a catch all route at the root of the app shouldn't intercept next generated assets or static assets.

Expect a working app where each non asset request resolves to the catch-all route but requests to next generated assets (_next/**/*) to resolve to the corresponding files.

Provide environment information
Operating System:
  Platform: linux
  Arch: x64
  Version: #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024
  Available memory (MB): 60075
  Available CPU cores: 16
Binaries:
  Node: 22.2.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: 9.9.0
Relevant Packages:
  next: 14.2.12 // An outdated version detected (latest is 15.0.3), upgrade is highly recommended!
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Navigation, Runtime

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

next dev (local), next start (local)

Additional context

For an in-production example of this issue with a workaround see https://github.com/session-foundation/websites/tree/main/apps/foundation

Note this is reopening this issue https://github.com/vercel/next.js/issues/67806

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction repository at r6203/next-catch-all-bug and run the reported case under both next dev and next start. Trace how the root catch-all route handles requests for static assets and _next-generated chunks. Done means non-asset requests still reach the catch-all route while generated and static assets resolve normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.