vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.92k stars 26.98k forks source link

intercepting routes: break when using middleware in dev mode #54148

Open cryptickoan opened 1 year ago

cryptickoan commented 1 year ago

Verify canary release

Provide environment information

Provide environment information
 Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103
    Binaries:
      Node: 18.4.0
      npm: 8.12.1
      Yarn: 1.22.17
      pnpm: 8.6.5
    Relevant Packages:
      next: 13.4.16
      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

vercel

https://github.com/cryptickoan/nextgram/tree/middleware

To Reproduce

Code can be found in the middleware branch of the nextgram fork i provided.

  1. Run the project locally
  2. Click a picture, modal will be shown
  3. Dismiss modal
  4. Click another picture, modal will not be shown

Describe the Bug

When running locally middleware rewrites break intercepting routes

Expected Behavior

When running locally middleware rewrites should work fine. Its a bit confusing I actually realized it was a development environment problem till I deployed this to Vercel to create an issue. It works fine in Vercel.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

locally

KairuDeibisu commented 1 year ago

I believe the following is related

54147

cryptickoan commented 1 year ago

they're both about intercepting routes but are not related.

54147 is about an issue with next.config.js rewrites, this one is about an issue with middleware rewrites in dev mode

khuezy commented 1 year ago

@cryptickoan your github repo link is 404ing now. I also notice that if you set request.headers, modal doesn't interception on next dev