Skip to content

Intercepting routes is broken (404) for nested dynamic routes on Vercel #54650

Description

@danjiro

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103
    Binaries:
      Node: 18.14.0
      npm: 9.3.1
      Yarn: N/A
      pnpm: 7.14.2
    Relevant Packages:
      next: 13.4.20-canary.9
      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) of Next.js are affected? (leave empty if unsure)

App Router

Link to the code that reproduces this issue or a replay of the bug

https://github.com/danjiro/test-intercept

To Reproduce

Deploy repo to Vercel or go here: https://test-intercept.vercel.app/
Click on any image, modal should popup, refresh, get 404

Describe the Bug

Intercepting routes for nested dynamic routes is broken when deployed to vercel. Works fine locally but when deployed to vercel, on intercepted route reload, the page 404s.

For example:

[username]/
├── [id]/
│   └── page.tsx
@modal/
├── [username]/
│   └── [id]/
│       └── page.tsx
└── default.tsx

will result in error on vercel. fine on local

[username]/
├── [id]/
│   └── page.tsx
@modal/
├── someuser/
│   └── [id]/
│       └── page.tsx
└── default.tsx

works fine on vercel and local similar to the nextgram example.

If the first level is dynamic, then it breaks on vercel

Expected Behavior

The modal should be intercepted and shown on soft navigation and the [username]/[id]/page.tsx should be rendered on hard navigation

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions