hapijs / hapijs/joi

PSA: Express v5 incompatibility

Open
#3,074 5 comments 0 reactions 0 assignees View on GitHub
support
Dominant language
JavaScript
Stars
21.2k
Forks
1.5k
Avg merge
4h 57m
Merged PRs (30d)
14

Description

### 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?

```js
const foo = schema.validate(req.query);
```
```
TypeError: Cannot set property query of # which has only a getter
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.