Skip to content

fix(profiling-node): Fix NODE_VERSION rendered as [object Object] in warning#19788

Merged
logaretm merged 1 commit intodevelopfrom
fix/profiling-node-version-stringify
Mar 13, 2026
Merged

fix(profiling-node): Fix NODE_VERSION rendered as [object Object] in warning#19788
logaretm merged 1 commit intodevelopfrom
fix/profiling-node-version-stringify

Conversation

@logaretm
Copy link
Member

@logaretm logaretm commented Mar 12, 2026

I found this while working on no-base-to-string rule, this is the only valid violation, the rest are buggy.

Summary

  • NODE_VERSION is a SemVer object ({ major, minor, patch }) from parseSemver() with no custom toString(). Interpolating it in a template literal produced [object Object] instead of the actual version number.
  • Since the surrounding check is ![16, 18, 20, 22, 24].includes(NODE_MAJOR), it makes more sense to log NODE_MAJOR (a number) in the warning message anyway.
  • Added a test verifying that NODE_VERSION has no custom toString() to prevent future misuse.

Test plan

  • Added unit test confirming NODE_VERSION stringifies as [object Object]
  • Existing profiling-node tests pass

🤖 Generated with Claude Code

Closes #19789 (added automatically)

…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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_VERSION is a plain object (no custom toString) and that its components format into an x.y.z string.

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}).`,
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
`[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}).`,

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.64 kB - -
@sentry/browser - with treeshaking flags 24.14 kB - -
@sentry/browser (incl. Tracing) 42.62 kB - -
@sentry/browser (incl. Tracing, Profiling) 47.28 kB - -
@sentry/browser (incl. Tracing, Replay) 81.42 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 86.12 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 98.37 kB - -
@sentry/browser (incl. Feedback) 42.45 kB - -
@sentry/browser (incl. sendFeedback) 30.31 kB - -
@sentry/browser (incl. FeedbackAsync) 35.36 kB - -
@sentry/browser (incl. Metrics) 26.92 kB - -
@sentry/browser (incl. Logs) 27.07 kB - -
@sentry/browser (incl. Metrics & Logs) 27.74 kB - -
@sentry/react 27.39 kB - -
@sentry/react (incl. Tracing) 44.95 kB - -
@sentry/vue 30.08 kB - -
@sentry/vue (incl. Tracing) 44.48 kB - -
@sentry/svelte 25.66 kB - -
CDN Bundle 28.27 kB - -
CDN Bundle (incl. Tracing) 43.5 kB - -
CDN Bundle (incl. Logs, Metrics) 29.13 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 44.34 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.2 kB - -
CDN Bundle (incl. Tracing, Replay) 80.32 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 85.86 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.76 kB - -
CDN Bundle - uncompressed 82.56 kB - -
CDN Bundle (incl. Tracing) - uncompressed 128.5 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.43 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.37 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.06 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.35 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.26 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.11 kB - -
@sentry/nextjs (client) 47.37 kB - -
@sentry/sveltekit (client) 43.07 kB - -
@sentry/node-core 56.34 kB +7.8% +4.07 kB 🔺
@sentry/node 173.19 kB -1.11% -1.93 kB 🔽
@sentry/node - without tracing 96.35 kB -1.11% -1.07 kB 🔽
@sentry/aws-serverless 113.34 kB +0.11% +116 B 🔺

View base workflow run

@logaretm logaretm merged commit f04a0dc into develop Mar 13, 2026
45 checks passed
@logaretm logaretm deleted the fix/profiling-node-version-stringify branch March 13, 2026 14:11
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.

fix(profiling-node): Fix NODE_VERSION rendered as [object Object] in warning

4 participants