Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/profiling-node/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import type { NodeClient, NodeOptions } from '@sentry/node';
import { CpuProfilerBindings, ProfileFormat, type RawThreadCpuProfile } from '@sentry-internal/node-cpu-profiler';
import { DEBUG_BUILD } from './debug-build';
import { NODE_MAJOR, NODE_VERSION } from './nodeVersion';
import { NODE_MAJOR } from './nodeVersion';
import { MAX_PROFILE_DURATION_MS, maybeProfileSpan, stopSpanProfile } from './spanProfileUtils';
import {
addProfilesToEnvelope,
Expand Down Expand Up @@ -634,7 +634,7 @@ export const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> =
consoleSandbox(() => {
// 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.
'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22, 24.',
'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',
'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',
Expand Down
11 changes: 11 additions & 0 deletions packages/profiling-node/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { NodeClientOptions } from '@sentry/node/build/types/types';
import { CpuProfilerBindings } from '@sentry-internal/node-cpu-profiler';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { _nodeProfilingIntegration } from '../src/integration';
import { NODE_VERSION } from '../src/nodeVersion';

function makeLegacySpanProfilingClient(): [Sentry.NodeClient, Transport] {
const integration = _nodeProfilingIntegration();
Expand Down Expand Up @@ -984,6 +985,16 @@ describe('ProfilingIntegration', () => {
});
});

describe('NODE_VERSION', () => {
it('is a plain object without a custom toString', () => {
// NODE_VERSION is a SemVer object from parseSemver — it has no custom toString().
// Code should never interpolate it directly in a template literal.
// Use process.versions.node or format the components manually instead.
expect(`${NODE_VERSION}`).toBe('[object Object]');
expect(`${NODE_VERSION.major}.${NODE_VERSION.minor}.${NODE_VERSION.patch}`).toMatch(/^\d+\.\d+\.\d+$/);
});
});

describe('Legacy vs Current API compat', () => {
describe('legacy', () => {
describe('span profiling', () => {
Expand Down
Loading