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
Cancelling a query you don't await crashes the process with an unhandled rejection #130
A cancelled query's own promise rejects (with 57014, or the server's error when the cancel arrives too late). Code that cancels a query and moves on without awaiting it gets an unhandled rejection, which ends a Node process by default:
constq=sql`select pg_sleep(10)`.execute()awaitq.cancel()// q is never awaited
UNHANDLED REJECTION: 57014 57014: canceling statement due to user request
Reproduced against the fork with a queued query (a server that accepts the connection and never answers). The code is unchanged from 3.4.9. Today every cancel needs a q.catch(() => {}) next to it.
Fix: query.cancel() marks the query's rejection as handled. Code that awaits the query still receives the error; code that cancels and moves on no longer crashes. Upstream has nothing reporting this; the nearest are the cancel request's own promise (upstream PR 1237, already handled here) and the internal type query being cancelled (upstream 1205).
Activity
chore: release 4.5.0
okomarov commentedon Oct 17, 2026
Shipped in 4.5.0.