Next.js 14 404 Error: Unhandled Promise Rejection

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

Next 13.3+ might not work on Netlify at the moment. Soon to change though…

Any ballpark estimate for how soon? Coming weeks or month?
We’ve got an imminent launch of a couple sites that have been waiting on a fix for a while.

The private beta is already active. GA might go in end of Q1 or early Q2. There might be a public beta before that though.

1 Like

Thanks @hrishikesh. Is the issue somewhere in the Netlify adapter plugin?

There are several, each about something broken in the current one. There’s a tracking issue which is internal. The beta version is available on npm: @netlify/plugin-nextjs - npm (npmjs.com) right now for anyone to use, but we won’t be liable to provide docs/support with any issues that might occur till we release a public beta except to the users who are currently enrolled in the private beta.

If you feel like it, feel free to try as the current one is anyways broken and you might as well have more luck with the new one. But in the event something breaks with that, please hold off from reporting any issues right away.

2 Likes