[T3 Connect] TypeScript SDK: fail the connection instead of crashing Node on a bad message - #6010
Draft
bradleyshep wants to merge 1 commit into
Draft
bradleyshep wants to merge 1 commit into
bradleyshep wants to merge 1 commit into
Conversation
bradleyshep
force-pushed
the
bradley/ts-sdk-node-crash
branch
2 times, most recently
from
September 30, 2026 17:38
593741b to
d6aa799
Compare
…nnot be applied A server message the client cannot decode or apply (for example, bindings out of step with the module's schema) threw out of the WebSocket message listener, as did an error thrown by a user callback. Browsers only report such errors; Node rethrows them on the next tick, which kills the host process. This matches the C# SDK: - A message that cannot be applied is logged, the queue is dropped and the socket closed, so onDisconnect receives the error. - A callback that throws is logged, and the other callbacks still run on an open connection.
bradleyshep
force-pushed
the
bradley/ts-sdk-node-crash
branch
from
October 1, 2026 17:26
d6aa799 to
5c8d0ea
Compare
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.
Description of Changes
Two kinds of error escaped the WebSocket message listener: a server message the client can't decode or apply (for example, client bindings out of step with the module's schema), and an error thrown by a user callback. Browsers only report such errors, but Node rethrows them on the next tick, which kills the host process.
This handles them the way the C# SDK already does:
onDisconnectreceives the error like any other failed connection.onInsert,onConnect,onApplied, …) is logged, and the remaining callbacks still run on an open connection. The cache is already up to date by the time callbacks run, so there's no reason to drop the connection. Dropping it would also make the framework providers reconnect, and the same callback would likely throw again on the re-sent rows.Split out of #6005 / #6006.
API and ABI breaking changes
None.
Rollback safety impact
n/a
Expected complexity level and risk
Testing
pnpm testincrates/bindings-typescript(324 passing)TransactionUpdatecarrying a row one byte short (standing in for bindings out of step with the module) no longer throws from the socket handler;onDisconnectreceives theRangeErrorand the connection closesonConnectcallback is logged, a secondonConnectcallback still runs, and the connection stays openSpacetimeDBClient.csdisconnects when message parsing fails, andTable.cs/SpacetimeDBClient.cscatch and log exceptions from user callbacks