vercel / vercel/next.js

app router does not resolve routes according to `generateStaticParams` constraints

Open
#69,770 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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://stackblitz.com/edit/stackblitz-starters-941nyd

To Reproduce
  1. click on "post 2" → it's a post
  2. click on "post 1" → it's a post
  3. click on "page 2" → it's a post
  4. click on "page 1" → it's a post
Current vs. Expected behavior

the "pages" urls should resolve with the page route, not the post route.

Provide environment information
irrelevant, happens in stackblitz too.
Which area(s) are affected? (Select all that apply)

Not sure

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

next dev (local)

Additional context

No response

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 linked StackBlitz reproduction and run it in next dev, following the four navigation steps involving post and page routes. Inspect the app router's handling of generateStaticParams constraints and compare which route resolves each URL. Done means the pages URLs resolve with the page route instead of the post route.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.