Repository navigation
Description
Severity: P2 · Area: SDK: Node · Found by: QA
Summary
init() from @telemetry-tracker/node installs a process.on("unhandledRejection") listener that reports the error and returns. Registering any such listener turns off Node's default behaviour, which since Node 15 is to crash with exit code 1. So an app that crashed on an unhandled rejection before adding the SDK keeps running after adding it, and exits 0.
There's no option to keep the default crash, and the docs say the opposite: /docs/node says "(and then rethrow / continue so your process can still exit or log as usual)".
A real-world consequence: in Express 4, an async route that throws leaves the HTTP request hanging (no response), because the process neither crashes nor responds.
Severity reason: P2. It silently changes crash semantics for every Node app that installs the SDK. Processes keep running in an unknown state, and supervisors and orchestrators never restart them. The error itself is reported (not lost), and it isn't a crash-capture failure like #711.
Affected published versions
@telemetry-tracker/[email protected](published 2026-07-02 16:14 CEST), with@telemetry-tracker/[email protected].- The repo
develop/maincode, still labelled 1.3.0, has the same listener, so the pending release in TT-012: Node SDK drops uncaught exceptions (re-throws before the error is sent) #711 doesn't change this.
Environment and versions
2026-09-26 10:40–10:50 CEST. Node 18.20.8, 20.19.2, 22.23.3, 24.21.0, 26.10.0, Linux. Express 4.22.3 / 5.2.1. Local mock ingest.
Steps to reproduce
- Run the mock:
// mock.mjs import http from "node:http"; http.createServer((req, res) => { let b = ""; req.on("data", c => b += c); req.on("end", () => { console.log(new Date().toISOString(), req.method, req.url, b.slice(0, 120)); res.writeHead(204).end(); }); }).listen(4318);
npm i @telemetry-tracker/[email protected], then createrejection.mjs:import { init } from "@telemetry-tracker/node"; init({ ingestUrl: "http://127.0.0.1:4318", app: "qa-node", apiKey: "test", environment: "qa" }); setTimeout(() => Promise.reject(new Error("QA unhandled rejection")), 300); setTimeout(() => console.error("still running 2 s after the rejection"), 2300);
node rejection.mjs; echo "exit=$?". Then comment outinit(...)and run it again.
Expected
The rejection is reported, and then Node's configured behaviour still applies: exit code 1 by default. At minimum there's an opt-out, and the docs describe what happens.
Actual
| Run | Rejection reported | Process after the rejection | Exit code |
|---|---|---|---|
| no SDK (control), Node 18–26 | – | crashes within 1 ms | 1 (5/5) |
| with SDK (npm 1.3.0), Node 18–26 | yes: 2/2 per run (Error and non-Error reason), context.source = "unhandledRejection", received 2–53 ms after the rejection |
keeps running, prints "still running…" | 0 (5/5) |
| with SDK, server responding after 500 ms / 3 s | yes (2/2) | keeps running | 0 |
| with SDK, endpoint unreachable | no (fetch failed) |
keeps running | 0 |
repo develop build, Node 18–26 |
yes | keeps running | 0 (5/5) |
Express 4, route app.get("/x", async () => { throw new Error() }) with app.use(middleware()): the request never gets a response (client timed out after 2 s, Node 20/22/24). The error is reported only as unhandledRejection. Express 5 returns 500 (it catches async errors itself).
Workaround: node --unhandled-rejections=strict routes the rejection to uncaughtException. With npm 1.3.0 that then hits #711 (exit 7, not reported).
Root cause
- npm
@telemetry-tracker/[email protected]dist/index.js:11-14: the listener only callscoreTrackError(err, { source: "unhandledRejection" }).installGlobalHandlers()is unconditional (dist/index.js:3-15, called frominitat:18). - repo
packages/telemetry-node/src/index.ts:32-36(distdist/index.js:15-18): the same. TelemetryConfig(coresrc/index.ts) has no option to skip or change the handlers.
Release coordination
Node package only (for example an exitOnUnhandledRejection / captureUnhandledRejections option, defaulting to Node's behaviour: report, flush via flushFatalError, exit 1). If it reuses flushFatalError/ingestError, it depends on the same core release as #711: core first, then node with ^<new core>. Ship it in the same node release as #711 if possible. The docs (/docs/node, /error-tracking/nodejs, docs/sdk-node.md) must describe the chosen behaviour.
Acceptance criteria
With the newly published @telemetry-tracker/node, on Node 20/22/24:
rejection.mjsreports exactly one/ingest/errorwithsource: unhandledRejection, then exits non-zero (or, if "keep running" is the default, the docs say so and an option restores the crash, verified both ways);- under
--unhandled-rejections=strict, the error is reported and the process exits 1; - the Express 4 async-throw route doesn't hang indefinitely when the option is enabled (process exits, so the supervisor restarts it).
Fix references
None yet.
History
- 2026-09-26 10:40–10:50 CEST: found and reproduced (25 SDK runs + 5 controls, Node 18–26; Express 4/5).
Filed from the QA regression list on 2026-09-26. Source: QA report 2026-09-26-sdk-qa.md (#tt-019).
Activity
fix(sdk): harden fatal throws and publish guards for #722
fix(sdk): prepare core 1.5 / node 1.4 / vite-plugin 1.1
unjica commentedon Oct 2, 2026
QA verification — PASS (closed)
When: 2026-10-02 ~08:56 CEST (weekday smoke)
Fix: PR #722 →
@telemetry-tracker/[email protected](depends on core^1.5.0; resolved 1.5.1)Method: Fresh registry install. unhandledRejection script ×2 against production; control without SDK.
Published dist defaults
exitOnUnhandledRejectionto true and usesflushFatalErrorfor rejections. Closing as verified-fixed.