Skip to content

Commit 83e9a39

Browse files
authoredMar 22, 2024
fix: fix proxying on next@<14.0.2 (#366)
1 parent a3f3dd9 commit 83e9a39

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎src/run/handlers/server.ts

+12
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ export default async (request: Request) => {
8080
return await tracer.withActiveSpan('generate response', async (span) => {
8181
const { req, res } = toReqRes(request)
8282

83+
// Work around a bug in http-proxy in next@<14.0.2
84+
Object.defineProperty(req, 'connection', {
85+
get() {
86+
return {}
87+
},
88+
})
89+
Object.defineProperty(req, 'socket', {
90+
get() {
91+
return {}
92+
},
93+
})
94+
8395
disableFaultyTransferEncodingHandling(res as unknown as ComputeJsOutgoingMessage)
8496

8597
const requestContext = getRequestContext() ?? createRequestContext()

‎tests/fixtures/simple-next-app-export/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "next build"
99
},
1010
"dependencies": {
11-
"next": "^14.1.1-canary.66",
11+
"next": "latest",
1212
"react": "18.2.0",
1313
"react-dom": "18.2.0"
1414
}

0 commit comments

Comments
 (0)
Please sign in to comment.