Skip to content

Commit e6e8ce9

Browse files
committed
fix(@angular/ssr): prevent stream draining if write does not return a boolean
Implements a workaround for CodeGenieApp/serverless-express#683 Closes #29801 (cherry picked from commit ee8466d)
1 parent 0ee24e2 commit e6e8ce9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/angular/ssr/node/src/response.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ export async function writeResponseToNodeResponse(
7272
}
7373

7474
const canContinue = (destination as ServerResponse).write(value);
75-
if (!canContinue) {
75+
if (canContinue === false) {
76+
// Explicitly check for `false`, as AWS may return `undefined` even though this is not valid.
77+
// See: https://github.com/CodeGenieApp/serverless-express/issues/683
7678
await new Promise<void>((resolve) => destination.once('drain', resolve));
7779
}
7880
}

0 commit comments

Comments
 (0)