fix(rsc): await handler to avoid unhandled rejection #576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
@mjackson/node-fetch-server's request handler is typed asvoid, but internally it can reject when response stream is broken for whatever reason (e.g. whenReadableStream/TransformStream'stransform,flush,pull, etc... throws).https://github.com/mjackson/remix-the-web/blob/b5aa2ae24558f5d926af576482caf6e9b35461dc/packages/node-fetch-server/src/lib/request-listener.ts#L87
I was comparing with
@hono/node-server(which is currently used by Waku) and this one swallows any stream errors internally, so the same won't happen. https://github.com/honojs/node-server/blob/cb52c36d1d5d5b68416c807ce4b231c8bc549e29/src/utils.ts#L20-L28. This difference might somehow affects this issue wakujs/waku#1521.Okay, this is likely irrelevant for Waku.
I cannot reproduce any crash externally, but this can happen if there's a "bug" in stream handling e.g.