-
Notifications
You must be signed in to change notification settings - Fork 167
fix(dev-overrides): Add automatic response cleanup via AbortSignal #952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
changeset changeset
🦋 Changeset detectedLatest commit: d3e4b48 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the other one in cloudflare for the same thing makes me think that we should use a single interface in aws.
What make the most sense IMO is probably to add an AbortSignal
in the StreamCreator. When it aborts, we just destroy the stream.
It's basically what you did, but using AbortSignal
instead of our own implementation
Thanks for the review Nico! This was an excellent idea. I am now using an |
To make
request.signal.onabort
work in route handlers. Currently only works fornode
andexpress-dev
. It will close theOpenNextNodeResponse
we pass intoNextServer
's request handler when the original response in the wrapper is closed. This will ensure that the AbortSignal associated withrequest.signal
is properly triggered when a client disconnects during a streaming response.I did try to get it to work with
awsLambda.streamifyResponse
. It looks like we get no event emitted onresponseStream
when a client disconnects. I even tried with a barebone Lambda like this: