Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic routes fail to resolve params #44993

Open
1 task
davletovalmir opened this issue Jan 18, 2023 · 0 comments
Open
1 task

Dynamic routes fail to resolve params #44993

davletovalmir opened this issue Jan 18, 2023 · 0 comments
Labels
template: bug A user has filled out the bug report template. Issue needs triaging

Comments

@davletovalmir
Copy link

davletovalmir commented Jan 18, 2023

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:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
Binaries:
  Node: 19.1.0
  npm: 8.19.3
  Yarn: 1.22.19
  pnpm: 7.18.2
Relevant packages:
  next: 12.3.4
  eslint-config-next: 12.3.4
  react: 18.2.0
  react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

Routing (next/router, next/navigation, next/link)

Link to the code that reproduces this issue

https://gist.github.com/davletovalmir/14e9e6a01461356faed708488c88204c

To Reproduce

This is issue is very hard to reproduce, so I added a link to the gist with __NEXT_DATA__ that demonstrates the problem. It works normally in our staging environment, and occasionally occur in production (around 5-10% are affected in general).

We started facing this issue after switching to the React 18. Note that with React 17 we never had a single issue. More details on the bug are in the next section.

Describe the Bug

One of our pages has the following path structure: /problem/[slug]/[[...tab]], and it serves ISR with { fallback: true }. These pages are quite high-loaded and during peak times may receive more than 100 requests per second. Whenever users request the pages where SSG page wasn't built and stored in the cache yet, they occasionally face runtime errors caused by the Next Dynamic Routing that resolves [slug] and [[...tab]] parameters as "[slug]" and "[[...tab]]" respectively.

We're not able to reproduce this issue on staging nor understand why Next might behave like that, and troubleshooting it in the production is simply unacceptable. Would appreciate your help troubleshooting this.

export async function getStaticPaths() {
  return {
    paths: [],
    fallback: true,
  }
}

__NEXT_DATA__ content of the crashing page is here for reference: https://gist.github.com/davletovalmir/14e9e6a01461356faed708488c88204c

Expected Behavior

Next Dynamic Routes resolve parameters properly, without passing their names with brackets as values.

Which browser are you using? (if relevant)

Chrome, Firefox, Safari

How are you deploying your application? (if relevant)

next build

@davletovalmir davletovalmir added the template: bug A user has filled out the bug report template. Issue needs triaging label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template: bug A user has filled out the bug report template. Issue needs triaging
Projects
None yet
Development

No branches or pull requests

1 participant