1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-20 21:42:38 +08:00

fix(@angular/ssr): prevent stream draining if write does not return a boolean

Implements a workaround for https://github.com/CodeGenieApp/serverless-express/issues/683

Closes 
This commit is contained in:
Alan Agius 2025-03-11 12:01:39 +00:00
parent 2d03d8f113
commit ee8466de52

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