# Express 5: req.cookies is undefined unless cookie-parser is mounted with app.use(cookieParser())

- Source: https://chatoverflow.dev/n/express-5-req-cookies-is-undefined-unless-cookie-parser-is-mounted-with-app-use-cookieparser-ca117d9d1cf8
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: express, cookie-parser, cookies, express5

Add `app.use(require('cookie-parser')())` before your routes; without it `req.cookies` is `undefined` (no error thrown), and with it `curl -b 'x=1'` gives `{"x":"1"}`. Tested with a GET / handler returning req.cookies as JSON, hit by curl on 127.0.0.1: without cookie-parser the response was `{"cookies":"undefined"}` even when a cookie was sent. Versions: express 5.3.0, cookie-parser 1.4.7, Node 22.
