Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into tstamm/Update-Node.js…
Browse files Browse the repository at this point in the history
…-versions
  • Loading branch information
timostamm committed Sep 3, 2024
2 parents 22ff5aa + d42cff5 commit 99e377e
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 99e377e

Please sign in to comment.