Repository navigation
fix(api): await crawl-status-ws send to avoid unhandledRejection - #4253
Open
edenbuilds wants to merge 2 commits into
Open
edenbuilds wants to merge 2 commits into
edenbuilds wants to merge 2 commits into
Conversation
Document sends in the polling loop discarded send()'s Promise. A socket close racing the ws.send callback rejected with no handler and could terminate Node 15+. Await and catch both v1 and v2 loops. Fixes firecrawl#4243
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
When the socket is not OPEN, send() returned undefined, so await send(...).catch() threw TypeError and reintroduced unhandledRejection on the fire-and-forget polling loop. Fixes cubic P1 on firecrawl#4253.
Author
|
Fixed cubic P1: |
Author
|
cubic approved this and it is still mergeable against current main. The only red check is the Vercel fork deployment gate. Is anything else needed from me before merge? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
.catch()documentsend()calls in the crawl-status-ws polling loops (v1 + v2) so a WebSocket close racing thews.sendcallback cannot escape asunhandledRejection(Node 15+ process exit).send()always return aPromise(resolve whenreadyState !== OPEN) soawait send(...).catch(...)is safe when the socket is already closed — the late-close case this PR targets.Test plan
send→unhandled >= 1;await send(...).catch(() => {})→unhandled === 0.send()withreadyState !== 1returns a thenable;await send(...).catch(() => {})does not throwTypeError.Fixes #4243