Hi!
I have a Next.js project in a nx monorepo. The build is working well, but when I try to open the webapp I get this error in the browser: error decoding lambda response: error decoding lambda response: unexpected end of JSON input
In the functions logs I found this error:
ERROR Unhandled Promise Rejection {“errorType”:“Runtime.UnhandledPromiseRejection”,“errorMessage”:“Error: Cannot find module ‘next/dist/server/lib/start-server.js’\nRequire stack:\n- /var/task/.netlify/dist/run/next.cjs”,“reason”:{“errorType”:“Error”,“errorMessage”:“Cannot find module ‘next/dist/server/lib/start-server.js’\nRequire stack:\n- /var/task/.netlify/dist/run/next.cjs”,“code”:“MODULE_NOT_FOUND”,“requireStack”:[“/var/task/.netlify/dist/run/next.cjs”],“stack”:[“Error: Cannot find module ‘next/dist/server/lib/start-server.js’”,“Require stack:”,“- /var/task/.netlify/dist/run/next.cjs”," at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)“,” at Module._load (node:internal/modules/cjs/loader:1051:27)“,” at Module.require (node:internal/modules/cjs/loader:1311:19)“,” at require (node:internal/modules/helpers:179:18)“,” at Object. (/var/task/.netlify/dist/run/next.cjs:499:30)“,” at Module._compile (node:internal/modules/cjs/loader:1469:14)“,” at Module._extensions…js (node:internal/modules/cjs/loader:1548:10)“,” at Module.load (node:internal/modules/cjs/loader:1288:32)“,” at Module._load (node:internal/modules/cjs/loader:1104:12)“,” at cjsLoader (node:internal/modules/esm/translators:346:17)“]},“promise”:{},“stack”:[“Runtime.UnhandledPromiseRejection: Error: Cannot find module ‘next/dist/server/lib/start-server.js’”,“Require stack:”,”- /var/task/.netlify/dist/run/next.cjs"," at process. (file:///var/runtime/index.mjs:1276:17)“,” at process.emit (node:events:519:28)“,” at emitUnhandledRejection (node:internal/process/promises:250:13)“,” at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)“,” at processPromiseRejections (node:internal/process/promises:470:17)“,” at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
- Site name: argiefy-monorepo
- Build settings:
I reviewed other topics with similar errors but didn’t find a solution.
Thanks!