Next.JS App Directory some pages are 500 Internal server error on deployment

Site name: upbeat-cori-27493e
Github link: GitHub - agneym/portfolio: Personal Portfolio Page

I have my portfolio site build with NextJS App directory deployed on Netlify. The page for a specific blog post gets to 500 Internal server error on reloading the page. However it works locally and on running with npx netlify-cli serve

Sample URLS:

Note that it works on click and route from inside the page. It does not work on direct navigation or reload though. I’m not sure how to debug this since it does not happen locally.

Did you check the function logs: Netlify App

It’s this issue: Server.edge not defined Error on nextJS SSR functions cause site to return 500 Errors

Hey @hrishikesh, Thanks for the reply.

I checked my logs and the error message did not seem to indicate the link you mentioned. Adding error message here:

ERROR MissingStaticPage [Error]: Failed to load static file for page: /404 The “listener” argument must be of type function. Received an instance of Object

This error must be fixed but it isn’t supposed to be a 404 page in the first place.

I tried setting the environment variable as mentioned in the page you have mentioned in your post through the Netlify CLI. But now the build fails with this error:

Invalid AWS Lambda parameters used in this request

This is what I see:

The other one that you’re seeing is for an actual 404 request (it’s for favicon.ico).

May be I was looking in the wrong place then, sorry.

I see the solution to this problem as listed in the thread is to set __NEXT_PRIVATE_PREBUNDLED_REACT= next. I have done this in my site, however now the build fails with Invalid AWS Lambda parameters used in this request. Can you help me out with this?

Please check out the entire thread, we’ve said this is not the solution and the actual solution is being worked upon. If we have to repeat the entire discussion here, it’s just creating a duplicate, which won’t help anyone :slight_smile:

If you’re desperate to solve this now, you can check out the workaround shared by another user:

If it’s not urgent, you can wait till we get to a long-term solution.

You can probably also downgrade Next.js to 13.2 I believe.

Thanks for your help @hrishikesh