Skip to content

fix(client): suppress unhandled rejection from WithStartWorkflowOperation#1990

Open
mjameswh wants to merge 3 commits intomainfrom
ts-fix-update-with-start-unhandled-rejection
Open

fix(client): suppress unhandled rejection from WithStartWorkflowOperation#1990
mjameswh wants to merge 3 commits intomainfrom
ts-fix-update-with-start-unhandled-rejection

Conversation

@mjameswh
Copy link
Copy Markdown
Contributor

@mjameswh mjameswh commented Apr 2, 2026

Summary

WithStartWorkflowOperation creates workflowHandlePromise eagerly with no .catch() handler. When executeUpdateWithStart fails at the gRPC transport level before any response is received, onStartError rejects workflowHandlePromise and re-throws to the caller. The caller's promise is rejected correctly, but the rejected workflowHandlePromise has no handler, causing a spurious unhandledRejection event that terminates the process.

Fix: add a no-op .catch(() => undefined) on workflowHandlePromise after construction — the same pattern used in packages/worker/src/activity.ts and packages/worker/src/worker.ts. Callers who await startOp.workflowHandle() still observe the rejection normally; if the caller ignores executeUpdateWithStart entirely, that unhandled rejection is still reported.

Also adds a regression test that verifies no spurious unhandledRejection event fires when the failure occurs and the caller never awaits workflowHandle().

Fixes #1960

@mjameswh mjameswh requested a review from a team as a code owner April 2, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] executeUpdateWithStart leaks unhandled Promise rejection when gRPC call fails before first response

2 participants