All of my Next.js v14.0.4 App router sites are failing to load 404 pages, only on deployments on Netlify. They all have in common generated pages using Optional Catch-All route segments with dynamicParams = false
.
404 handling works perfectly fine in local dev and local build environments. Also works perfectly fine in Vercel deployments.
There is a similar topic here:
which hasn’t been updated for over 2 months so reviving as a new thread here.
Is Netlify still not fully compatible for Next.js App Router with dynamic routes?
Logs:
Runtime.UnhandledPromiseRejection - Error: Error handling request. See function logs for details.
Stack Trace
Runtime.UnhandledPromiseRejection: Error: Error handling request. See function logs for details.
at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)
at process.emit (node:events:529:35)
at emit (node:internal/process/promises:149:20)
at processPromiseRejections (node:internal/process/promises:283:27)
at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
Netlify Function Logs
Jan 22, 02:58:26 PM: INIT_START Runtime Version: nodejs:18.v19 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:5f3775e8514c9422c179089d8c93b55a6d1df5a60e7e37e1e2ae46daf845be72
Jan 22, 02:58:27 PM: 9209b29a ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: Error handling request. See function logs for details.","reason":{"errorType":"Error","errorMessage":"Error handling request. See function logs for details.","stack":["Error: Error handling request. See function logs for details."," at Server.<anonymous> (/var/task/.netlify/functions-internal/___netlify-handler/___netlify-handler.js:88:23)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: Error handling request. See function logs for details."," at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)"," at process.emit (node:events:529:35)"," at emit (node:internal/process/promises:149:20)"," at processPromiseRejections (node:internal/process/promises:283:27)"," at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}
Jan 22, 02:58:27 PM: Unknown application error occurred
Runtime.Unknown
Jan 22, 02:58:27 PM: 9209b29a Duration: 492.97 ms Memory Usage: 102 MB Init Duration: 414.24 ms
Jan 22, 02:58:27 PM: INIT_START Runtime Version: nodejs:18.v19 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:5f3775e8514c9422c179089d8c93b55a6d1df5a60e7e37e1e2ae46daf845be72