You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wsLink: AbortSignal on operations is ignored — abort does not cancel in-flight requests or subscriptions #7439
The WebSocket link does not honor the AbortSignal passed with an operation. Calling abort() on the signal has no effect on in-flight queries, mutations, or subscriptions sent through wsLink.
Repro
const controller = new AbortController();
const result = trpc.someQuery.query(undefined, { signal: controller.signal });
controller.abort(); // has no effect on the WS request
Contrast with httpSubscriptionLink which correctly tears down the subscription when the signal fires.
Root cause
wsClient.ts:235 calls signal?.removeEventListener('abort', abort) in the cleanup path — but there is no corresponding signal?.addEventListener('abort', ...) anywhere in the wsLink source. The abort listener was never registered; only the cleanup was scaffolded.
This appears to be an incomplete implementation from the v11 refactor (PR #6223) which plumbed signal into the request function but only wired the teardown half.
Verified via the current source — signal is received at lines ~186 and ~190, but only removeEventListener is called (line 235); no addEventListener call exists anywhere in the wsLink directory.
Expected behaviour
When the caller's AbortSignal fires:
In-flight queries/mutations: the pending request should be cancelled and the promise rejected with AbortError
Subscriptions: the subscription should be torn down
Possible fix
In the request() function, after the early-exit check for signal?.aborted, add:
and ensure teardownFn removes the listener when the operation completes normally (which is what the existing removeEventListener call at line 235 already does — it just has no matching registration).
🤖 Fixed by #7434 — wsLink now registers and cleans up the AbortSignal listener. Closing; please reopen with a repro if you still see this on the latest release.
This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.
Activity
fix(client): handle AbortSignal events and pre-aborted signals in wsLink
fix(client): handle AbortSignal events and pre-aborted signals in wsLink
fix(client): handle AbortSignal events and pre-aborted signals in wsLink
fix(client,server): wire AbortSignal in wsLink and delete stale clien…
trpc-bot commentedon Oct 19, 2026
🤖 Fixed by #7434 —
wsLinknow registers and cleans up theAbortSignallistener. Closing; please reopen with a repro if you still see this on the latest release.github-actions commentedon Oct 21, 2026
This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.