Skip to content

Commit cfd411e

Browse files
JonasBalforst
andauthored
fix(profiling-node): Always warn when running on incompatible major version of Node.js (#14043)
This seems important enough to warn about each time regardless of debug build Fixes: #14015 --------- Co-authored-by: Luca Forstner <[email protected]>
1 parent 3dc4d08 commit cfd411e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

packages/profiling-node/src/integration.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import type { NodeClient } from '@sentry/node';
1212
import type { Event, IntegrationFn, Profile, ProfileChunk, ProfilingIntegration, Span } from '@sentry/types';
1313

14-
import { LRUMap, logger, uuid4 } from '@sentry/utils';
14+
import { LRUMap, consoleSandbox, logger, uuid4 } from '@sentry/utils';
1515

1616
import { CpuProfilerBindings } from './cpu_profiler';
1717
import { DEBUG_BUILD } from './debug-build';
@@ -426,13 +426,16 @@ class ContinuousProfiler {
426426

427427
/** Exported only for tests. */
428428
export const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> => {
429-
if (DEBUG_BUILD && ![16, 18, 20, 22].includes(NODE_MAJOR)) {
430-
logger.warn(
431-
`[Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION}).`,
432-
'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22.',
433-
'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',
434-
'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',
435-
);
429+
if (![16, 18, 20, 22].includes(NODE_MAJOR)) {
430+
consoleSandbox(() => {
431+
// eslint-disable-next-line no-console
432+
console.warn(
433+
`[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION}).`,
434+
'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22.',
435+
'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',
436+
'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',
437+
);
438+
});
436439
}
437440

438441
return {

0 commit comments

Comments
 (0)