0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

fix: Destroy the node http server response stream if there was a caught error (#12333)

This commit is contained in:
Matt Callaway 2024-10-31 13:47:32 +00:00 committed by GitHub
parent 5f7bf49d38
commit 836cd91c37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Destroy the server response stream if async error is thrown

View file

@ -153,8 +153,10 @@ export class NodeApp extends App {
} }
destination.end(); destination.end();
// the error will be logged by the "on end" callback above // the error will be logged by the "on end" callback above
} catch { } catch (err) {
destination.end('Internal server error'); destination.write('Internal server error', () => {
err instanceof Error ? destination.destroy(err) : destination.destroy();
});
} }
} }
} }