fix: More Node v18 issues#21662
Open
timfish wants to merge 3 commits into
Open
Conversation
| 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); |
Contributor
There was a problem hiding this comment.
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:130packages/opentelemetry/src/tracingChannel.ts:56
Did we get this right? 👍 / 👎 to inform future reviews.
andreiborza
approved these changes
Jun 19, 2026
andreiborza
left a comment
Member
There was a problem hiding this comment.
Good idea putting this on ci!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes another usage of
tracingChannelwhich isn't supported in Node v18.0.0.I also added a test to ensure we don't break this again at import time.