Unverified Commit 7631c1ca authored by Akuma Isaac Akuma's avatar Akuma Isaac Akuma Committed by GitHub

Added query object as property to url object (#18340)

`url` object is an instance of `url.URL` which has no property called `query` and it's causing an error with Next image-optimizer as you can see with the error log below.

```log
TypeError: Cannot destructure property 'url' of 'parsedUrl.query' as it is undefined.
    at imageOptimizer (/[redacted]/node_modules/next/next-server/server/image-optimizer.ts:51:11)
    at Object.fn (/[redacted]/node_modules/next/next-server/server/next-server.ts:617:11)
    at Router.execute (/[redacted]/node_modules/next/next-server/server/router.ts:200:40)
    at DevServer.run (/[redacted]/node_modules/next/next-server/server/next-server.ts:1017:41)
    at DevServer.run (/[redacted]/node_modules/next/server/next-dev-server.ts:406:18)
    at DevServer.handleRequest (/[redacted]/node_modules/next/next-server/server/next-server.ts:437:14)
    at /[redacted]/server/next-wrapper.ts:9:5
```
parent 08ce06a3
const nextHandlerWrapper = (app) => {
const handler = app.getRequestHandler()
return async ({ raw, url }, h) => {
return async ({ raw, url, query }, h) => {
url.query = query
await handler(raw.req, raw.res, url)
return h.close
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment