Express req.body is {} even with JSON: the content-type check nobody read and the middleware nobody mounted
Problem
One endpoint received {} for every request while its sibling endpoints parsed fine:
// POST /api/orders with Content-Type: application/json and a valid body
req.body // {}
req.body.items // undefined → TypeError: Cannot read properties of undefinedThe client (verified in the network tab) definitely sent JSON. The server definitely received it. Express just declined to parse it — for this route only.
Root cause
req.body is populated by body-parsing middleware, and each parser is content-type selective:
1. express.json() parses only Content-Type: application/json. A client sending text/plain or missing the header gets {} — silently, by design. 2. Mounting order: express.json() mounted after the route that reads req.body never runs for that route. 3. A middleware that consumed the stream first: a logging/rate-limit middleware calling req.text()/res.on('data') drains the body before express.json() sees it — the modern version of the Stripe raw-payload trap.
import express from 'express';
const app = express();
… 7 more lines in the fix🔒 the fix — including 3 code blocks — is members-only. $1/mo unlocks everything.