From e7d80f66ec73626a345ea7ea61a3003de7ee1391 Mon Sep 17 00:00:00 2001 From: JonasBa Date: Mon, 21 Oct 2024 10:44:28 -0400 Subject: [PATCH 1/2] fix(profiling) always warn when running on incompatible major version of nodejs --- packages/profiling-node/src/integration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/profiling-node/src/integration.ts b/packages/profiling-node/src/integration.ts index 2eb0a59142ae..19174b06c2e3 100644 --- a/packages/profiling-node/src/integration.ts +++ b/packages/profiling-node/src/integration.ts @@ -426,7 +426,7 @@ class ContinuousProfiler { /** Exported only for tests. */ export const _nodeProfilingIntegration = ((): ProfilingIntegration => { - if (DEBUG_BUILD && ![16, 18, 20, 22].includes(NODE_MAJOR)) { + if (![16, 18, 20, 22].includes(NODE_MAJOR)) { logger.warn( `[Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION}).`, 'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22.', From c12461e98edc0aca1cf40ae2d1d1b7392e27e364 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 21 Oct 2024 14:49:09 +0000 Subject: [PATCH 2/2] Avoid the biggest mistake of our entire lives --- packages/profiling-node/src/integration.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/profiling-node/src/integration.ts b/packages/profiling-node/src/integration.ts index 19174b06c2e3..1af7b8d82dea 100644 --- a/packages/profiling-node/src/integration.ts +++ b/packages/profiling-node/src/integration.ts @@ -11,7 +11,7 @@ import { import type { NodeClient } from '@sentry/node'; import type { Event, IntegrationFn, Profile, ProfileChunk, ProfilingIntegration, Span } from '@sentry/types'; -import { LRUMap, logger, uuid4 } from '@sentry/utils'; +import { LRUMap, consoleSandbox, logger, uuid4 } from '@sentry/utils'; import { CpuProfilerBindings } from './cpu_profiler'; import { DEBUG_BUILD } from './debug-build'; @@ -427,12 +427,15 @@ class ContinuousProfiler { /** Exported only for tests. */ export const _nodeProfilingIntegration = ((): ProfilingIntegration => { if (![16, 18, 20, 22].includes(NODE_MAJOR)) { - logger.warn( - `[Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION}).`, - 'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22.', - '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', - ); + 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}).`, + 'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22.', + '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', + ); + }); } return {