Replies: 3 comments 4 replies
-
Hi, I can't reproduce:
With this export const dynamicParams = true
export async function generateStaticParams() {
return [{ 'special-event': 'hello%20world' }]
}
export default async function SpecialEventPage({ params }: { params: Promise<{ 'special-event': string }> }) {
const awaitedParams = await params
const thisRouteName = awaitedParams['special-event'].split('%20').join(' ')
return <div>{thisRouteName}</div>
} |
Beta Was this translation helpful? Give feedback.
-
I've done more testing. I can confirm the following:
I'm unable to understand how all of the above could be true, work perfectly in Next 14 but not 15, unless there is something wrong with Next 15's use of dynamicParams. |
Beta Was this translation helpful? Give feedback.
-
I will add that if I take the same post that I am trying to generate on demand, and build/deploy again with it already published, the post works correctly on the site. There is nothing wrong or corrupt with the post itself, as long as it exists at build time it will work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have a website in production that uses dynamicParams with getStaticParams to generate new post pages after build time, with posts fetched from Contentful. It works perfectly with Next 14.2.3, generating pages correctly at build time and on demand. I have been unable to upgrade it to Next 15, the build time pages work correctly but I can't generate new pages on demand. I'm currently trying to upgrade to Next 15.3.4, but I had the same problem with 15.1 and 15.2. The updating of existing post pages that were generated at build time works in 15.3.4, I have a webhook triggering revalidatePath for that.
The error that I'm getting is below. There is only 1 place where I use split, so it suggests that the params aren't being passed correctly for me in Next 15.
TypeError: Cannot read properties of undefined (reading 'split')
at s (.next/server/chunks/20.js:1:776)
at m (.next/server/app/special-events/[special-event]/page.js:1:981)
I've seen the docs about changes with getStaticParams in Next 15, but I'm confused about how it might apply to my project. I've also tried updating the Contentful package to the latest version, which didn't change anything. I'm out of ideas for now. I've included my Next 14 and 15 codes in this post. Any help is appreciated very much!
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions