This has been dogging me for nearly 2 years and is nearly impossible to Google because of how it’s described.
Basically, I currently have an endpoint that throws a known error. Locally, this gives me the error boundary page we always intended.
When deployed on Vercel however, and contrary to the Next.js docs, this gives me the generic Vercel “serverless function has crashed” page.
I have never been able to figure out why it shows the Vercel page and not the page we intended. How do we get it to stop showing the Vercel crash page and show our own?
That is odd. It could be due to a range of different reasons, I’d love to see a minimal reproducible example if you can provide one!
Otherwise, some troubleshooting tips:
Review the logs to identify any specific errors related to the Serverless Function being invoked. You can find these logs at the host URL under the /_logs path.
Review your function and make sure doesn’t contain any errors or infinite loops.
If your function is taking too long to process a request, it might be timing out.
If your function depends on environment variables, make sure they are correctly defined in your Preview and Production environments.