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
[Bug] Node middleware calls next() twice when req.on is missing #632
In packages/telemetry-node/src/index.ts, if req.on is missing, the else branch calls next() then done(), then execution falls through to another next().
Proposed change
Call next() once on all paths, and add coverage so it cannot regress.
Why this matters
Generic middleware is the Node integration story. Double next() breaks adapters.
Suggested implementation
packages/telemetry-node/src/index.ts
Keep this issue focused on the bug fix. Package-level Vitest setup is tracked separately.
Acceptance criteria
next is invoked once
$request is still recorded
Tests added/updated where applicable
Documentation updated where applicable
Contributor notes
This should be a good first contribution and does not require deep knowledge of the Telemetry Tracker architecture.
Reproduced on published [email protected] with Fastify 5.12.5 onRequest hook (request has no .on): done called 2×, route handler executed twice for 4 of 5 routes on Node 20/22/24; duration_ms 0–1 ms. See #720.
Fixed: the middleware now calls next() exactly once on every path and records $request after it when there's no response emitter (commit 0cea057, shipped in @telemetry-tracker/node 1.4.0 on npm). Closing as completed.
Activity
unjica commentedon Sep 26, 2026
Reproduced on published [email protected] with Fastify 5.12.5 onRequest hook (request has no .on): done called 2×, route handler executed twice for 4 of 5 routes on Node 20/22/24; duration_ms 0–1 ms. See #720.
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 16, 2026
Fixed: the middleware now calls
next()exactly once on every path and records$requestafter it when there's no response emitter (commit 0cea057, shipped in @telemetry-tracker/node 1.4.0 on npm). Closing as completed.