#3074·joi

PSA: Express v5 incompatibility

Author: bazinetaCreated Apr 8, 2025Updated Apr 13, 2025
Labelssupport

Runtime

node.js

Runtime version

Any

Module version

Any

Used with

Express v5

Any other relevant information

Mix of a public service announcement and a question regarding Express v5 compatibility.

There are seemingly innumerable documents published about how to do exciting things like validate Express' req.query using Joi, which in Express v4, works a treat.

Hoping to avoid others running into what I ran into this morning, req.query is immutable in Express v5, which effectively kills the usual approaches; curious if anyone's come up with a clever compatibility solution for this, as at this point, I can describe several promising approaches that don't work.

How can we help?

javascript
const foo = schema.validate(req.query);
TypeError: Cannot set property query of #<IncomingMessage> which has only a getter