req.query is now a getter and can't use as custom server in front of Next.js #6637
ale-grosselle
started this conversation in
General
Replies: 1 comment
-
While I wasn't around at the time when that commit was made and possibly discussed, I found reasons (#3472 (comment), #2752 (comment)) from the former maintainer for making this just a getter. The long-term solution is to use req.locals to store the query and modify it later, i'm not sure how this could work for Next.js, #3472 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using Express as a custom server in front of Next.js, accessing req.query directly no longer returns a mutable plain object. Instead, it is now a getter, and attempts to modify it or use it as a plain object lead to unexpected behavior or errors.
This change affects routes where the server modifies or depends on the mutability of req.query before passing it to Next.js, breaking compatibility with existing implementations.
Next.js Issue:
vercel/next.js#79158
Context
We applied the following patch, but we do not believe it is the best solution:
Is it possible to know why Express decided to change? This would help us understand where we need to make adjustments (on the Next.js side or the Express.js side).
Beta Was this translation helpful? Give feedback.
All reactions