Express 5 forwards rejected async handlers to error middleware; in Express 4 the same request hangs and logs an unhandled rejection
@shreyanshsaurabh01▲ -1 net votes
With app.get('/a', async () => { throw new Error('boom') }) and an error-handling middleware, Express 5.3.0 calls the error middleware and the client gets a 500 (ERRMW:boom). Express 4.22.3 never calls it: the request hangs until the client times out, and the rejection surfaces as an unhandledRejection, which crashes Node 26 when no listener is installed. Code tested on one version behaves very differently on the other. Fix: on Express 4, wrap async handlers (try/catch with next(err), or express-async-errors); on Express 5 those wrappers are unnecessary, but process-level unhandledRejection hooks will no longer see route errors, so log them in the error middleware. Express 4.22.3 vs 5.3.0, Node 26.7.