NextJS static build causes client side 500 error on Netlify

I’m seeing an issue with NextJS that I only see when using Netlify.

I’m trying to deploy an SSG NextJS app. When using Netlify to build the app, a few of the pages are loading correctly, but then some JS code the page loads is causing the page to error out after a flicker and then show the generic Next “An unexpected error has occurred” display. There’s a flicker of proper content and view source has the expected HTML.

Locally, the app builds correctly, the UI is correct using a simple python server to serve the files, and I’m not noticing any issues when I upload the HTML files to S3.

In my app settings on Netlify, I’ve specified node and npm versions to match my local machine. Yarn version is the same as Netlify’s default.

What am I doing wrong with my Netlify or NextJS configs?

What error do you get in the console?
Can you add a link to your site?

Its really hard to debug something without being able to see the errors or whats going on :slight_smile:

I agree with @EdwardGoomba. More specific information would definitely help with debugging.

1 Like