-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Which project does this relate to?
Start
Describe the bug
When a client disconnects during streaming, the resulting DOMException: The connection was closed cannot be caught and floods the production server logs.
This issue often arises from bots or users closing the tab while streaming is still in progress.
Your Example Website or App
https://github.com/checkerschaf/start-domexception-aborterror
Steps to Reproduce the Bug or Issue
- Clone the reproduction repo
- Run
bun install - Run
bun run build - Start the server:
bun run bun-server.ts - Run the script
bun run reproduce-abort-error.tsin a new terminal while the server is running
Expected behavior
No errors in the server console and the streaming cancellation should be handled gracefully.
Screenshots or Videos
No response
Platform
- Start Version: 1.140.5
- Bun: 1.3.4
Additional context
Full error logs:
error: The connection was closed.
cause: DOMException {
line: 4174,
column: 32,
sourceURL: "/Users/xyz/tart-domexception-aborterror/node_modules/react-dom/cjs/react-dom-server.bun.production.js",
stack: "@/Users/xyz/tart-domexception-aborterror/node_modules/react-dom/cjs/react-dom-server.bun.production.js:4174:32\nPromise@\n@/Users/xyz/tart-domexception-aborterror/node_modules/react-dom/cjs/react-dom-server.bun.production.js:4137:23\n@/Users/xyz/tart-domexception-aborterror/node_modules/@tanstack/react-router/dist/esm/ssr/renderRouterToStream.js:12:63\nrenderRouterToStream@/Users/xyz/tart-domexception-aborterror/node_modules/@tanstack/react-router/dist/esm/ssr/renderRouterToStream.js:5:37\n@/Users/xyz/tart-domexception-aborterror/dist/server/server.js:315:32\nprocessTicksAndRejections@",
code: 20,
name: "AbortError",
message: "The connection was closed.",
INDEX_SIZE_ERR: 1,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR: 3,
WRONG_DOCUMENT_ERR: 4,
INVALID_CHARACTER_ERR: 5,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR: 7,
NOT_FOUND_ERR: 8,
NOT_SUPPORTED_ERR: 9,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_STATE_ERR: 11,
SYNTAX_ERR: 12,
INVALID_MODIFICATION_ERR: 13,
NAMESPACE_ERR: 14,
INVALID_ACCESS_ERR: 15,
VALIDATION_ERR: 16,
TYPE_MISMATCH_ERR: 17,
SECURITY_ERR: 18,
NETWORK_ERR: 19,
ABORT_ERR: 20,
URL_MISMATCH_ERR: 21,
QUOTA_EXCEEDED_ERR: 22,
TIMEOUT_ERR: 23,
INVALID_NODE_TYPE_ERR: 24,
DATA_CLONE_ERR: 25,
toString: [Function: toString],
},
status: 500,
statusText: undefined,
headers: undefined,
data: undefined,
body: undefined,
unhandled: true,
at /Users/xyz/tart-domexception-aborterror/node_modules/h3-v2/dist/h3.mjs:315:41
romulovalezcoderabbitai
Metadata
Metadata
Assignees
Labels
No labels