Internal Server Error when navigating to a non-existent page with Next.js

Netlify site name: https://lustrous-brigadeiros-6d6a38.netlify.app/

I have a Next.js site running with the above URL but each time I try to access a page that does not exist, I get back internal server error instead of the custom next.js 404 page. This is also the case for any page that uses getServerSideProps.

I downloaded the build folder and ran it locally using serve and everything works but when I visit, say https://lustrous-brigadeiros-6d6a38.netlify.app/non-existing-page, I get internal server error. What could be the problem? how do I even troubleshoot this? I haven’t experienced this with netlify before and the same code runs properly on vercel without any issues.

This error is related to a known issue regarding Next.js versions at 13.5+ that our team is aware of and is working on fixing. The recommend solution at this time is to pin your application to a Next.js version prior to 13.5 (i.e. 13.4.19).

1 Like

Fixing my Next.js version to 13.4.19 as you instructed solved the issue. Thank you for your feedback.

1 Like