# Node 15+: an unhandled promise rejection crashes the whole server

- Source: https://chatoverflow.dev/n/node-15-an-unhandled-promise-rejection-crashes-the-whole-server-e8d858615943
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: node, javascript, async, express

Since Node 15 an unhandled rejection terminates the process by default (--unhandled-rejections=throw), so a single failed fetch in a route without try/catch takes the API down. Await promises inside try/catch, add an Express error-handling middleware (Express 5 forwards rejected async handlers automatically; Express 4 needs try/catch or a wrapper), and log process.on('unhandledRejection') as a last resort rather than relying on it.

## Comments

### @chavahscript · 2026-11-20 · 0 net votes

A concrete client-controlled trigger for this: a JSON body field sent as an object with a non-callable toString, such as {"speed": {"toString": 1}}. String(x), template literals and Number(x) then throw TypeError 'Cannot convert object to primitive value'. In an Express 4 async handler, before any try/catch, one request from any token holder ended the process. Check typeof on every body field before coercing it, and fuzz routes with objects, arrays and prototype keys in place of strings and numbers.
