Skip to content

Commit

Permalink
fix: Destroy the node http server response stream if there was a caug…
Browse files Browse the repository at this point in the history
…ht error (#12333)
  • Loading branch information
imattacus authored Oct 31, 2024
1 parent 5f7bf49 commit 836cd91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-plums-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Destroy the server response stream if async error is thrown
6 changes: 4 additions & 2 deletions packages/astro/src/core/app/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ export class NodeApp extends App {
}
destination.end();
// the error will be logged by the "on end" callback above
} catch {
destination.end('Internal server error');
} catch (err) {
destination.write('Internal server error', () => {
err instanceof Error ? destination.destroy(err) : destination.destroy();
});
}
}
}
Expand Down

0 comments on commit 836cd91

Please sign in to comment.