Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using with Express v5 #47

Open
IAmVisco opened this issue Jan 24, 2025 · 5 comments · May be fixed by #48
Open

Error when using with Express v5 #47

IAmVisco opened this issue Jan 24, 2025 · 5 comments · May be fixed by #48

Comments

@IAmVisco
Copy link

IAmVisco commented Jan 24, 2025

When using with Express v5 you get an error like

TypeError: Cannot set property query of #<IncomingMessage> which has only a getter
    at expressJoiValidator (...\node_modules\express-joi-validation\express-joi-validation.js:81:21)

Which leads here
I assume it happens due to sanitization. Anything that can be done about it? Thanks.

@evanshortiss
Copy link
Owner

Seems like the query object has changed per express 5.x migration docs. I guess it might be necessary to change this module's behaviour to set a new validatedQuery or similar on req. Not ideal, since this is a breaking change.

WDYT?

@IAmVisco
Copy link
Author

IAmVisco commented Feb 1, 2025

If possible, I'd love to see a major release supporting Express v5. It's not going to be widely adopted for a long time, but I've seen people (myself included) tinker with it on pet projects.

@evanshortiss
Copy link
Owner

Totally understand. I don't have much bandwidth though. I've asked people that opened issues/PRs if they'd like to become maintainers - is that something you might be interested in?

@IAmVisco
Copy link
Author

IAmVisco commented Feb 6, 2025

Probably not, sorry.

@IAmVisco IAmVisco linked a pull request Feb 7, 2025 that will close this issue
@IAmVisco
Copy link
Author

IAmVisco commented Feb 7, 2025

@evanshortiss I tinkered with it and the fix was quiet easy. I copied the approach Celebrate implemented years ago. Another approach would be to use req.locals.query, which would be very breaking. Celebrate fix is backwards compatible too. Take a look when you have a minute #48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants