#Custom error.tsx page is not rendered for dynamic routes using generateStaticParams

1 messages · Page 1 of 1 (latest)

keen ravine
#

I have a fairly large localized (next-intl) website which has multiple dynamic routes. I'm using generateStaticParams to prerender localized routes.

I'm facing an issue where error.tsx is not catching errors on the app and the default Vercel error screen is displayed instead of my own custom error.tsx component

  • Error boundaries work fine without generateStaticParams
  • As soon as generateStaticParams is added (along with dynamicParams = true), error boundaries stop catching errors for dynamic routes (the ones not pre-rendered during build) in production, while working perfectly in dev mode.

I found this year-old issue (https://github.com/vercel/next.js/issues/62046) but there have been no activity on this thread. I'm trying to find an alternate workaround for this and would really appreciate any suggestions you must have.

GitHub

Link to the code that reproduces this issue https://github.com/bkrajewski94/next-isr-error-page-bug To Reproduce Install dependencies with npm install Build the application with npm run build Start...