Domain based i18n 500 page error redirects to default locale

Hi @gijsbotje
Apologies for the delayed response.

Given that the 500.js file is present in the Vercel output but still causing a missing module error, there could be possibly a routing or locale-specific issue affecting error page handling?

Since you’re using middleware to handle the /product/[...slug] routing, can you try logging its behavior during error scenarios? I wonder if the middleware is affecting locale-specific paths for the 500 page.

Also I assume, 500.js for en is served without any disturbance caused from custom routing rules.

Can you also check if any caching rules or edge functions on Cloudflare could be interfering with locale handling?

I totally understand how tiresome troubleshooting might be but it will all be totally worth it once we found the root cause!
Also, given that Vercel Team is so helpful, I believe they will be able to help us get to the root of this and make it work as expected!

Let me know if you have made some progress here!