You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Run
next info
(available from version 12.0.8 and up)What version of Next.js are you using?
12.0.10
What version of Node.js are you using?
17.1.0
What browser are you using?
Chrome
What operating system are you using?
macOS 11.5.2
How are you deploying your application?
next start
Describe the Bug
When using
getServerSideProps
,context.params
isundefined
when unencoded URL path is the same as the dynamic route's name.Consider having a route called
[slug].tsx
.If you access
/[slug]
,context.params
equalsundefined
✖️If you access
/%5Bslug%5D
,context.params
equals{ slug: '[slug]' }
✔️If you access
/foo[slug]
,context.params
equals{ slug: 'foo[slug]' }
✔️If you access
/[slug]foo
,context.params
equals{ slug: '[slug]foo' }
✔️If you access
/[uuid]
,context.params
equals{ slug: '[uuid]' }
✔️Minimal working example: https://github.com/kudlajz/nextjs-dynamic-route
Expected Behavior
For
/[slug]
URL path,context.params
should be correctly defined as{ slug: '[slug]' }
To Reproduce
pages/[slug].tsx
getServerSideProps
function/[slug]
in your application (make sure the brackets are not encoded)context.params
insidegetServerSideProps
The text was updated successfully, but these errors were encountered: