Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Node.js v16 error responses on HTTP1.1 #1206

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/conformance-express.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [21.1.0, 20.9.0, 18.16.0]
node-version: [21.1.0, 20.9.0, 18.16.0, 16.20.0]
name: "Node.js ${{ matrix.node-version }}"
timeout-minutes: 10
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conformance-fastify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [21.1.0, 20.9.0, 18.16.0]
node-version: [21.1.0, 20.9.0, 18.16.0, 16.20.0]
name: "Node.js ${{ matrix.node-version }}"
timeout-minutes: 10
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conformance-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [21.1.0, 20.9.0, 18.16.0]
node-version: [21.1.0, 20.9.0, 18.16.0, 16.20.0]
side: [client, server]
name: "Node.js ${{ matrix.node-version }} ${{ matrix.side }}"
timeout-minutes: 10
Expand Down
11 changes: 10 additions & 1 deletion packages/connect-node/src/node-universal-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,16 @@ export async function universalResponseToNodeResponse(
async function* asyncIterableFromNodeServerRequest(
request: NodeServerRequest,
): AsyncIterable<Uint8Array> {
for await (const chunk of request) {
const it = request.iterator({
// Node.js v16 closes request and response when this option isn't disabled.
// When one of our handlers receives invalid data (such as an unexpected
// compression flag in a streaming request), we're unable to write the error
// response.
// Later major versions have a more sensible behavior - we can revert this
// workaround once we stop supporting v16.
destroyOnReturn: false,
});
for await (const chunk of it) {
yield chunk;
}
}
Expand Down