Based on the information provided in the knowledge sources, it appears that you're encountering an issue with Incremental Static Regeneration (ISR) and dynamic parameters in Next.js. Let's address your problem:
The issue you're experiencing is likely related to the behavior of generateStaticParams and dynamicParams in combination with revalidation. Here's what might be happening:
- Your
generateStaticParams function is generating static paths for existing blog posts at build time.
- You've set
dynamicParams = true, which should allow for generating new paths on demand.
- You've also set
revalidate = 3600 for time-based revalidation.
However, there's a known issue with on-demand revalidation and statically generated pages using generateStaticParams. According to the Github issue #63479, on-demand revalidation can sometimes remove statically generated pages, leading to 404 errors for previously generated paths.
To fix this issue, you can try the following approaches:
-
Remove generateStaticParams and rely solely on dynamic rendering:
This will cause all pages to be rendered on-demand, which might impact performance but will ensure new posts are always accessible.
-
Use dynamicParams = false instead of true:
This will prevent Next.js from attempting to generate new paths dynamically, but it will also mean that new blog posts won't be accessible until you rebuild the site.