fix(profiling-node): Fix NODE_VERSION rendered as [object Object] in warning#19788
fix(profiling-node): Fix NODE_VERSION rendered as [object Object] in warning#19788
Conversation
…bject] in warning NODE_VERSION is a SemVer object from parseSemver() with no custom toString(), so interpolating it in a template literal produced "[object Object]" instead of the actual version. Since the check is for unsupported major versions, use NODE_MAJOR (a number) which stringifies correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the profiling-node integration to avoid interpolating the parsed NODE_VERSION object in warning logs, and adds a regression test to document/guard the NODE_VERSION shape/behavior.
Changes:
- Replace
${NODE_VERSION}with${NODE_MAJOR}in the “no prebuilt binaries” Node.js warning. - Add a test asserting
NODE_VERSIONis a plain object (no customtoString) and that its components format into anx.y.zstring.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/profiling-node/src/integration.ts | Adjusts the runtime warning message to avoid stringifying the NODE_VERSION object. |
| packages/profiling-node/test/integration.test.ts | Adds a regression test documenting NODE_VERSION stringification behavior and component formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // eslint-disable-next-line no-console | ||
| console.warn( | ||
| `[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION}).`, | ||
| `[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_MAJOR}).`, |
There was a problem hiding this comment.
The warning now interpolates only NODE_MAJOR but the text says "Node.js version"; this makes the message less informative for debugging (e.g., users can’t tell which minor/patch they’re running). Consider either (a) interpolating process.versions.node for the full version string, or (b) adjusting the wording to explicitly say "Node.js major version" if you want to keep just the major number.
| `[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_MAJOR}).`, | |
| `[Sentry Profiling] You are using a Node.js major version that does not have prebuilt binaries (major ${NODE_MAJOR}).`, |
size-limit report 📦
|
I found this while working on
no-base-to-stringrule, this is the only valid violation, the rest are buggy.Summary
NODE_VERSIONis aSemVerobject ({ major, minor, patch }) fromparseSemver()with no customtoString(). Interpolating it in a template literal produced[object Object]instead of the actual version number.![16, 18, 20, 22, 24].includes(NODE_MAJOR), it makes more sense to logNODE_MAJOR(a number) in the warning message anyway.NODE_VERSIONhas no customtoString()to prevent future misuse.Test plan
NODE_VERSIONstringifies as[object Object]🤖 Generated with Claude Code
Closes #19789 (added automatically)