Commit 456d8e7
fix: ensure req.query is writable (#81573)
### What?
- Upgrade development dependency **Express** to the latest version
(5.1.0).
- Replace direct assignment of `apiReq.query` with
`Object.defineProperty` to ensure the property is writable, enumerable,
and configurable.
### Why?
- To use the most up-to-date and supported version of Express instead of
a legacy one.
- To fix
[expressjs/express#6633](expressjs/express#6633),
where Express 5.x defines `req.query` as a read-only getter, preventing
Next.js from overriding it directly.
### How?
- Update the Express version in `package.json` and run `pnpm install` to
apply the change.
- Replace:
```js
apiReq.query = query;
```
With
```js
Object.defineProperty(apiReq, 'query', {
value: { ...query },
writable: true,
enumerable: true,
configurable: true,
});
```
---------
Co-authored-by: Alessandro Grosselle <[email protected]>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Beltran <[email protected]>
Co-authored-by: Tim Neutkens <[email protected]>1 parent 0b6fe15 commit 456d8e7
File tree
4 files changed
+78
-2
lines changed- packages/next/src/server/api-utils/node
- test/e2e/api-resolver-query-writeable
- pages/api
4 files changed
+78
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
359 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
360 | 366 | | |
361 | 367 | | |
362 | 368 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments