Next.js · Senior · Question 44 of 75
What's the right outcome for an error in generateStaticParams during the build?
- ✓Correct answer: The build fails, and the broken version doesn't reach production
- 2Next.js ignores the error and builds the route without pages
- 3The route automatically switches to client-side rendering
Explanation
generateStaticParams runs during next build before pages render. An error (e.g. an unavailable API) aborts the build - better than shipping an app without pages. If the source is unreliable, you can return a subset of paths and render the rest on demand.