Repository navigation
Description
Severity: P1 · Area: SDK: Node · Found by: QA
Summary
@telemetry-tracker/node 1.3.0 never reports uncaught exceptions: it re-throws inside its own uncaughtException handler, so the process exits (code 7) before the error is sent. This is the primary crash-capture path of the Node SDK (also used by the NestJS guide), and it fails silently while the docs promise these errors are captured.
Environment and versions
Production API 1.17.23, 2026-09-26 10:00–10:02 CEST. @telemetry-tracker/[email protected] (npm latest, published 2026-07-02) with @telemetry-tracker/[email protected]. Node 20.19.2 and 22.23.3, Linux.
Steps to reproduce
npm init -y && npm i @telemetry-tracker/node- Create
uncaught.mjs:import { init } from "@telemetry-tracker/node"; init({ ingestUrl: "https://api.telemetry-tracker.com", app: "my-api", apiKey: process.env.TELEMETRY_API_KEY, platform: "node" }); setTimeout(() => { throw new Error("Node sweep uncaughtException"); }, 200);
node uncaught.mjs, then check Issues and/api/errors?app=my-api.
Expected
As documented ("After init(), uncaughtException and unhandledRejection are patched to send errors to the ingest API (and then rethrow…)"), the crash appears in Issues, then the process exits.
Actual
The process exits immediately with code 7; the stack points at the SDK's dist/index.js throw err;. 0/3 production crashes arrived (checked 20 s later). Against a local mock ingest, the SDK sent the session and a handled control error but no /ingest/error for the crash (Node 20 and 22). Handled trackError, trackEvent, release/environment tagging and unhandledRejection from the same scripts all arrived. Reproduced 4/4.
Acceptance criteria
With the newly published @telemetry-tracker/node@latest, on Node 20 and Node 22 with a valid key:
- the process still exits non-zero;
- within 10 s,
GET /api/errors?app=my-api&q=uncaughtExceptionreturns the group withcontext.source = "uncaughtException"; - against a local HTTP mock, exactly one
POST /ingest/erroris sent before exit; unhandledRejectionand handled-error behaviour unchanged;- total time ≤ the documented flush timeout.
Fix references
- Repo fix: commits
0e9158e(PR Scope source map uploads and flush fatal Node errors #672) ande2dae47(PR Publish Node SDK fatal-flush build #675), 2026-09-25:flushFatalErrorawaitsingestError, then exits. - Not published: npm
@telemetry-tracker/nodeis still 1.3.0, and the fix needsingestErrorfrom core, which npm[email protected]does not export (repo core is also still labelled 1.4.0). Needs a core + node release, then retest against the published package.
History
- 2026-09-26 10:00–10:02 CEST: found and reproduced 4/4 on API 1.17.23. Not retested on 1.17.24 because the npm fix isn't published.
Migrated from the QA regression list on 2026-09-26. Source: QA report 2026-09-26-sweep.md (#tt-012).
Activity
unjica commentedon Sep 26, 2026
QA SDK re-test, 2026-09-26 10:40–10:50 CEST: reproduced with the published packages against a local mock ingest. Node 18/20/22/24/26, Linux. Status unchanged: open. No fix is published yet.
Published packages under test
gitHeadin npm metadata@telemetry-tracker/nodelatest)@telemetry-tracker/corelatest, resolved by node's^1.3.0)Reproduction (anyone can run it)
node uncaught.mjs; echo "exit=$?"givesexit=7. The mock logsPOST /ingest/sessionand nothing else.Results: 3 throw sites × 5 Node versions, plus slow and unreachable endpoints
/ingest/errorreceivedsetTimeoutthrow,fs.readFilecallback throwsetTimeoutthrow, server delaying its response 500 ms / 3 s, or unreachabledevelopbuild (node dist + core dist @ c652e61)fetch failed, error lost)Other observations:
process.on("exit")listeners don't run on the crash (0/15). With no SDK, and with the repo build, they do.node_modules/@telemetry-tracker/node/dist/index.js:9 throw err;) and prints[Symbol(telemetry.reported)]: true.node --unhandled-rejections=strictroutes rejections into the same handler, so it also exits 7 without reporting (npm, Node 20/22/24).Root cause
@telemetry-tracker/[email protected]dist/index.js:7-10:process.on("uncaughtException", err => { coreTrackError(err, …); throw err; }). CoretrackError([email protected] dist/index.js:392-420) firessend()→fetchwithout awaiting (dist/index.js:277-300). The synchronous re-throw inside the listener is a fatal error: Node exits with code 7 before the fetch even connects.9798ea3("Rename SDK packages…", committed 2026-07-02 16:15:56 CEST, 89 s after the publish). The repo source there (packages/telemetry-node/src/index.ts:21-24) has the samethrow err.develop/main(identical for this package),packages/telemetry-node/src/index.ts:25-30+src/fatal.ts:1-21(distdist/index.js:9-14,dist/fatal.js):flushFatalErrorracesingestError()against 2000 ms, thenprocess.exit(1). That's commits0e9158e(src) ande2dae47(dist), butpackage.jsonis still 1.3.0.The repo fix can't ship alone: it needs a new core
ingestErrorfrom core (src/index.ts:6). Published[email protected]doesn't export it. Its runtime exports areSDK_VERSION WEB_VITAL_EVENT_NAME buildIngestHeaders buildWebVitalProperties endSession getAnonymousId getConfigOrNull getSessionId getUserId identify init installWebVitals isWebVitalsCaptureEnabled rateWebVital resolveClientPiiScrub screen scrubPiiRecord scrubPiiText setWebVitalsCaptureEnabled shutdown trackError trackEvent.tscfails:src/index.ts(6,3): error TS2305: Module '"@telemetry-tracker/core"' has no exported member 'ingestError';SyntaxError: The requested module '@telemetry-tracker/core' does not provide an export named 'ingestError', exit 1, nothing sent (Node 18–26, 5/5).ingestErrorexists only in the repo core (packages/telemetry-core/src/index.ts:508, dist:413). The repo core is still labelled 1.4.0 and differs from npm 1.4.0: it addsingestErrorand the Web-Crypto UUID fallback froma92510e/5501575. npm core 1.4.0 = repo3a61577dist, byte-identical."@telemetry-tracker/core": "workspace:*"(published as^1.3.0), a node release with the fix would install the broken combination for anyone whose lockfile keeps core 1.4.0.Release coordination (proposal, not executed)
@telemetry-tracker/[email protected](new exportingestError, so minor), from a clean checkout withgitHeadrecorded.@telemetry-tracker/[email protected](or 1.4.0) with"@telemetry-tracker/core": "^1.5.0", so it can never resolve to 1.4.0.process.on("exit")listeners run, a 3 s server gives exit 1 at ~2 s, and the unreachable endpoint gives exit 1 without hanging.npm deprecate @telemetry-tracker/[email protected] "uncaught exceptions are not reported; upgrade to >=1.3.1".Follow-up notes, not blocking this issue:
$requestevents in the 5 s batch are dropped on the crash (0/3 received in the middleware test where a sync handler throw killed the server).fix(sdk): harden fatal throws and publish guards for #722
fix(sdk): non-mutating error dedupe for frozen fatals
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]+@telemetry-tracker/core@^1.5.0; clean-room resolve got core 1.5.1)Method: Fresh registry install (not repo workspace). Ran the acceptance uncaughtException script twice against production ingest.
Previously (npm 1.3.0): exit 7, 0
/ingest/error. Published dist includesflushFatalErrorand no longer re-throws inside the handler.Closing as verified-fixed on the published packages.