Astro Info
Astro v3.5.2
Node v20.2.0
System macOS (x64)
Package Manager pnpm
Output server
Adapter @astrojs/node
Integrations @astrojs/tailwind
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When implementing server-sent events, cancel() is not called when client closes the connection (e.g. closes the tab).
export async function GET() {
const stream = new ReadableStream({
start(controller) {
// do stuff
},
cancel() {
console.log("cancelled");
},
});
return new Response(stream, {
headers: {
"X-Content-Type-Options": "nosniff",
"Content-Type": "text/event-stream; charset=utf-8",
"Transfer-Encoding": "chunked",
},
});
}
What's the expected result?
cancelled is logged to the console
Link to Minimal Reproducible Example
https://github.com/pilcrowOnPaper/astro-readable-stream-bug
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When implementing server-sent events,
cancel()is not called when client closes the connection (e.g. closes the tab).What's the expected result?
cancelledis logged to the consoleLink to Minimal Reproducible Example
https://github.com/pilcrowOnPaper/astro-readable-stream-bug
Participation