Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Nov 12, 2025

I guess this got through CI because we test latest 18 rather than 18.0.0.

This breaks some supported Electron versions which are using >18.0.0 but <18.19.0.

This wont have impacted almost anyone else because Otel requires 18.19.0!

[App] [    Main] App threw an error during load
[App] [    Main] file:///home/runner/work/sentry-electron/sentry-electron/test/e2e/dist/error-after-ready/node_modules/@sentry/node-core/build/esm/integrations/pino.js:1
[App] [    Main] import { tracingChannel } from 'node:diagnostics_channel';
[App] [    Main]          ^^^^^^^^^^^^^^
[App] [    Main] SyntaxError: The requested module 'node:diagnostics_channel' does not provide an export named 'tracingChannel'
[App] [    Main]     at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
[App] [    Main]     at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
[App] [    Main] A JavaScript error occurred in the main process

const injectedChannel = tracingChannel('orchestrion:pino:pino-log');
const integratedChannel = tracingChannel('pino_asJson');
const injectedChannel = diagnosticsChannel.tracingChannel('orchestrion:pino:pino-log');
const integratedChannel = diagnosticsChannel.tracingChannel('pino_asJson');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Import Change Hides tracingChannel Bug

Changing from named import to namespace import doesn't fix the missing tracingChannel export in Node <18.19.0. The code will now throw a runtime error (diagnosticsChannel.tracingChannel is not a function) when setup executes instead of an import-time error. This makes debugging harder and violates the documented Node version requirement without any runtime check or graceful fallback.

Fix in Cursor Fix in Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This integration is only supported on Node where tracingChannel is supported

@timfish timfish requested a review from AbhiPrasad November 12, 2025 18:14
@github-actions
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,920 - 9,300 -4%
GET With Sentry 1,360 15% 1,359 +0%
GET With Sentry (error only) 6,300 71% 6,056 +4%
POST Baseline 1,206 - 1,198 +1%
POST With Sentry 518 43% 543 -5%
POST With Sentry (error only) 1,066 88% 1,061 +0%
MYSQL Baseline 3,345 - 3,317 +1%
MYSQL With Sentry 461 14% 500 -8%
MYSQL With Sentry (error only) 2,753 82% 2,711 +2%

View base workflow run

Comment on lines +125 to +126
const injectedChannel = diagnosticsChannel.tracingChannel('orchestrion:pino:pino-log');
const integratedChannel = diagnosticsChannel.tracingChannel('pino_asJson');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Pino integration crashes on Node < 18.19.0 due to diagnosticsChannel.tracingChannel() being undefined.
Severity: CRITICAL | Confidence: 0.98

🔍 Detailed Analysis

The pino integration will crash with a "TypeError: diagnosticsChannel.tracingChannel is not a function" at runtime when its setup() function is called on Node versions < 18.19.0. This occurs because the code at lines 125-126 attempts to call diagnosticsChannel.tracingChannel() without checking if the method exists, as diagnosticsChannel.tracingChannel is undefined on these older Node versions. This unexpected crash violates the integration's documented Node version requirements.

💡 Suggested Fix

Implement version checks for diagnosticsChannel.tracingChannel() similar to SentryNodeFetchInstrumentation.ts to ensure it's only called on Node >= 18.19.0, or handle the undefined case gracefully by providing a fallback or no-op.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: packages/node-core/src/integrations/pino.ts#L125-L126

Potential issue: The pino integration will crash with a "TypeError:
diagnosticsChannel.tracingChannel is not a function" at runtime when its `setup()`
function is called on Node versions < 18.19.0. This occurs because the code at lines
125-126 attempts to call `diagnosticsChannel.tracingChannel()` without checking if the
method exists, as `diagnosticsChannel.tracingChannel` is `undefined` on these older Node
versions. This unexpected crash violates the integration's documented Node version
requirements.

Did we get this right? 👍 / 👎 to inform future reviews.

Reference_id: 2618499

@AbhiPrasad AbhiPrasad merged commit 090a3e3 into develop Nov 12, 2025
141 checks passed
@AbhiPrasad AbhiPrasad deleted the timfish/fix/tracing-channel branch November 12, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants