Internal Server Error when Refreshing a Page

Hello everyone.

So my issue happens whenever I refresh (F5) one of the pages in my app, it returns an internal server error and I can see in netlify’s website that the issue is according to below image:

Current version of next and netlify plugin packages:
@netlify/plugin-nextjs”: “^4.41.3”,
“next”: “14.2.5”,

I tried upgrading netlify/plugin-nextjs to the latest version, and got this error when accessing any page in deploy preview link:

"ERROR Unhandled Promise Rejection {“errorType”:“Runtime.UnhandledPromiseRejection…”

My app always tries to generate the token from a route inside the “Pages/api/token/”, this error points to accessing the URL /api/token.

What can I do to fix this issue? I have searched a lot in previously opened issues in Github, Netlify’s forum and no solution has worked so far…

Thanks in advance.

Hi @grafiniti-eric,

Thanks for reaching out!

You’ll want to ensure you’re using the Netlify/Next.js runtime v5 instead of 4.41.3 since you’re using Next.js 14.2.5. Version 5 of the runtime is for Next.js 13.5+.

You can read more here:

If you continue to have issues, please let us know your sitename (such as sitename.netlify.app). Thanks!

Hey Melvin, thanks for the reply but I already said that I tried updating netlify’s plugin to tha latest version and the problem was even worse: it gets an error getting into ANY page. And I see that error on netlify’s Logs (mentioned in the post too…).

The sitename is test.grafiniti.com

What else could be happening?

The link asks me to sign in. How can I reproduce the issue?

Hey! So in the end I rolled back Next.js version to 13.4.19 and adjusted other library and it worked… didn’t want to do this but it seemed like the only choice for now.

Thanks for now guys, you can close this issue now :slight_smile: