Skip to content

fix: More Node v18 issues#21662

Open
timfish wants to merge 3 commits into
developfrom
timfish/fix/node-v18-issues
Open

fix: More Node v18 issues#21662
timfish wants to merge 3 commits into
developfrom
timfish/fix/node-v18-issues

Conversation

@timfish

@timfish timfish commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes another usage of tracingChannel which isn't supported in Node v18.0.0.

I also added a test to ensure we don't break this again at import time.

@timfish timfish marked this pull request as ready for review June 19, 2026 16:17
@timfish timfish requested a review from a team as a code owner June 19, 2026 16:17
@timfish timfish requested review from JPeer264, Lms24 and andreiborza and removed request for a team June 19, 2026 16:17
setupOnce() {
DEBUG_BUILD && debug.log(`[orchestrion:mysql] subscribing to channel "${CHANNELS.MYSQL_QUERY}"`);
const queryCh = tracingChannel(CHANNELS.MYSQL_QUERY);
const queryCh = diagnosticsChannel.tracingChannel(CHANNELS.MYSQL_QUERY);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The change to a namespace import introduces a runtime TypeError on Node.js <18.19.0 when mysqlChannelIntegration is used, as diagnosticsChannel.tracingChannel will be undefined.
Severity: MEDIUM

Suggested Fix

Add a runtime check to ensure diagnosticsChannel.tracingChannel is a function before calling it. This will prevent the TypeError on older Node.js versions where the API does not exist, effectively guarding the integration's setup.

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/server-utils/src/integrations/tracing-channel/mysql.ts#L76

Potential issue: The change from a named import to a namespace import (`import * as
diagnosticsChannel`) prevents a load-time crash on Node.js versions below 18.19.0.
However, it introduces a new runtime bug. On these older Node versions,
`diagnosticsChannel.tracingChannel` is `undefined`. When the `mysqlChannelIntegration`
is initialized, its `setupOnce()` method is called, which attempts to execute
`diagnosticsChannel.tracingChannel(...)`. This results in a `TypeError:
diagnosticsChannel.tracingChannel is not a function`, crashing the application at
runtime during SDK initialization.

Also affects:

  • packages/node-core/src/integrations/pino.ts:130
  • packages/opentelemetry/src/tracingChannel.ts:56

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

@andreiborza andreiborza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good idea putting this on ci!

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.

2 participants