Next.js Discord

Discord Forum

Domain based i18n 500 page error redirects to default locale

Unanswered
Western yellowjacket posted this in #help-forum
Open in Discord
Avatar
Western yellowjacketOP
Recently, one of our sites is having some weird behavior. Without any changes to the 500.js file, the following error occurs when a page throws a 500 error.
Error: Cannot find module '/var/task/.next/server/pages/500.js'

This results in the .com site to redirect to the default locale (.nl) where it is able to show the proper 500 page.
An example of a URL that behaves like this
https://www.diamondsbyme.com/rings/classic-white-gold-emeralds-half-eternity-stackable-ring-tanisha/

When you visit this page, an external fetch throws an error, resulting in the page to error out. I expect it to show the 500 error message on the .com domain.

When I tried debugging it with sub route localization, it just works.
https://dbm-com.vercel.app/en/rings/classic-white-gold-emeralds-half-eternity-stackable-ring-tanisha/

I'm using next@14.2.15 with pages router and trailingSlash option in the next config is on and localeDetection is off. We use a middleware to internally route the example URL to /product/[...slug]. The site is proxied through Cloudflare to cache JSON files and monitor bots.

Anybody have some troubleshooting steps?

0 Replies