Recent errors on website

My site name is development-ionicprotocol, accessible at development.ionic.money.

We have been deploying fine for weeks, but now our development build just started showing an error on the live site:

This function has crashed
An unhandled error in the function code triggered the following message:

Error - Cannot find module 'next/dist/compiled/@next/react-dev-overlay/dist/middleware' Require stack: - /var/task/node_modules/next/dist/server/web/sandbox/context.js - /var/task/node_modules/next/dist/server/lib/render-server.js - /var/task/node_modules/next/dist/server/lib/router-server.js - /var/task/node_modules/next/dist/server/lib/start-server.js - /var/task/packages/ui/.netlify/dist/run/next.cjs

Stack trace
Error: Cannot find module 'next/dist/compiled/@next/react-dev-overlay/dist/middleware'
Require stack:
- /var/task/node_modules/next/dist/server/web/sandbox/context.js
- /var/task/node_modules/next/dist/server/lib/render-server.js
- /var/task/node_modules/next/dist/server/lib/router-server.js
- /var/task/node_modules/next/dist/server/lib/start-server.js
- /var/task/packages/ui/.netlify/dist/run/next.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at /var/task/node_modules/next/dist/server/require-hook.js:55:36
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at mod.require (/var/task/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/var/task/node_modules/next/dist/server/web/sandbox/context.js:45:24)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
Connection details
Netlify internal ID: 01HV1HM9895YT5AW99PPQE9H2Q

We did not update any dependencies nor change any code that should have caused this error. Can anyone help us to debug where this is coming from?

Are you using Next.js 13.5+? If so, please upgrade to Next.js Runtime v5.

Actually I think the runtime 5 is what broke it. We reverted back to runtime 4 and that fixed it:

v4 doesn’t support Next.js 14.

Hmm, were there any recent changes? Our site was working fine, then all of a sudden new deploys broke, and this PR fixed them.

Hi, @rhlsthrm. The site in question is not using the Netlify build system. This site is being deployed manually. This means the issue occurred in your local builds which we cannot see to debug.

By the way, it looks like this site build with Node.js 16 based on this:

https://github.com/ionicprotocol/monorepo/blob/development/.nvmrc

Node.js 16 isn’t supported anymore:

Even version 18 is maintenance support only. I’d strong recommend getting your site upgraded to use at least Node.js 20 before doing any other troubleshooting.

Again, we do not support using the netlify/plugin-nextjs version 4 with Next.js 14. If you are using Next.js 14, we only provide support for the version 5 package. If you are not using version 5 of netlify/plugin-nextjs for Next.js 14, we will not be able to provide any troubleshooting support until this is resolved.

Hi, the .nvmrc should be updated, but all of our CI pipelines as well as local dev envs actually do use Node v20.

Also you can see a pipeline here: Merge pull request #279 from ionicprotocol/development · ionicprotocol/monorepo@fcf721a · GitHub

This looks like it is actually running builds through Netlify using netlify link and netlify deploy.

I want us to upgrade to the latest plugin version but it does not make sense to me why downgrading it fixed it.

Hi Luke, we have confirmed the following things:

  • We are using Node 20 everywhere.
  • We upgraded to the latest Next.js version.
  • We are using the Netlify build system (see CI pipeline).

We confirmed that simply setting the netlify/plugin-nextjs to v4 versus omitting it from the package.json is the difference between working and not working.

Is there any suggestion for what can be going wrong? Our UI and pipeline code is all open source.

That runs builds locally (or in the CI platform), not on Netlify.

I just tried to build your website and it failed:

Deploy details | Deploys | f-116186 | Netlify

Here are my settings: