Express: req.body is undefined / {} (body parser missing)
Express didn’t parse the request body because no body-parsing middleware matched the request’s Content-Type.
Seen on:
Node.js
Meaning
Express needs express.json() for JSON and express.urlencoded() for form posts. multipart/form-data needs multer/busboy. The middleware must be registered before the routes.
Common causes
- express.json() not registered (or registered after routes)
- Client not sending Content-Type: application/json
- Form data needing urlencoded or multer
- Wrong body parser for the type
⚡ Quick fix
- app.use(express.json()) before routes
- Send the correct Content-Type
- Use multer for file uploads
Detailed fix by platform
Node.js
- javascript
app.use(express.json()); app.use(express.urlencoded({ extended: true }));
How to diagnose
- Middleware — Registered and before routes?
- Header — Content-Type of the request
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026