You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start the custom server in development mode with node server.mjs
Navigate to /api/hello in the browser
The response will fail and the console will show this error:
⨯ [TypeError: Cannot set property query of #<IncomingMessage> which has only a getter] {
page: '/api/hello'
}
Current vs. Expected behavior
I had no trouble using Express 4 as a custom server in front of Next.js. But when I tried to upgrade to Express 5, I started seeing this error when trying to access any API endpoint in the Pages Router. Pages still load fine.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023
Available memory (MB): 4242
Available CPU cores: 2
Binaries:
Node: 20.12.0
npm: 10.5.0
Yarn: 1.22.19
pnpm: 8.15.6
Relevant Packages:
next: 15.2.0 // There is a newer version (15.3.2) available, upgrade recommended!
eslint-config-next: 15.2.0
react: 19.0.0
react-dom: 19.0.0
typescript: 5.7.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I was able to reproduce the same error in 14.2.26. My guess would be that Next.js has always had a compatibility issue with Express 5, though if that's the case then I'm surprised I haven't seen more reports of this issue.
The text was updated successfully, but these errors were encountered:
I have exactly this issue. I was also surprised why I haven't seen it reported anywhere.
I thought once I was able to upgrade to next v15 it might resolve but it has not.
My API routes are not getting hit and I see the error TypeError: Cannot set property query of #<IncomingMessage> which has only a getter
I am not attempting to set the value of query or req.query anywhere.
Everything else is working fine in my application, the only issue I have is when I try to call an API route.
The same problem . No "req.query =". when i use fetch post to get data to push in a datatable--> TypeError: Cannot set property query of # which has only a getter
My error is in compiling time.
my code
export default async function handler(req, res) {
console.log('hello!');
}
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/ws2m7y
To Reproduce
node server.mjs
/api/hello
in the browserThe response will fail and the console will show this error:
Current vs. Expected behavior
I had no trouble using Express 4 as a custom server in front of Next.js. But when I tried to upgrade to Express 5, I started seeing this error when trying to access any API endpoint in the Pages Router. Pages still load fine.
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I was able to reproduce the same error in 14.2.26. My guess would be that Next.js has always had a compatibility issue with Express 5, though if that's the case then I'm surprised I haven't seen more reports of this issue.
The text was updated successfully, but these errors were encountered: