Skip to content

Commit 68c1aa8

Browse files
authored
fix(v8/profiling-node): Restore install script to build binaries from source (#20517)
This PR adds the `install` script back compiles bindings from source if precompiled binaries are not found. We removed this in `8.55.1` when we fixed our CI to run on this legacy branch but v8 does not ship with a precompiled Node 24 binary. Users on Node 24 crash with `Cannot find module` errors. It also fixes deprecation warnings for `spawnSync` calls and an interpolation error in the profiling integration console warning. Closes: #20501
1 parent c385754 commit 68c1aa8

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/profiling-node/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"/scripts/prune-profiler-binaries.js"
5151
],
5252
"scripts": {
53+
"install": "node scripts/check-build.js",
5354
"clean": "rm -rf build && rm -rf lib",
5455
"lint": "yarn lint:eslint && yarn lint:clang",
5556
"lint:eslint": "eslint . --format stylish",
@@ -63,6 +64,8 @@
6364
"build:types:downlevel": "yarn downlevel-dts lib/types lib/types-ts3.8 --to ts3.8",
6465
"build:types": "tsc -p tsconfig.types.json && yarn build:types:downlevel",
6566
"build:types:watch": "tsc -p tsconfig.types.json --watch",
67+
"build:bindings:configure": "node-gyp configure",
68+
"build:bindings": "node-gyp build && node scripts/copy-target.js",
6669
"build:copy-bindings": "cp -r compiled-bindings/ lib/",
6770
"build:dev": "yarn clean && yarn build",
6871
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",

packages/profiling-node/scripts/check-build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function clean(err) {
1111

1212
function recompileFromSource() {
1313
console.log('@sentry/profiling-node: Compiling from source...');
14-
let spawn = child_process.spawnSync('npm', ['run', 'build:bindings:configure'], {
14+
let spawn = child_process.spawnSync('npm run build:bindings:configure', {
1515
stdio: ['inherit', 'inherit', 'pipe'],
1616
env: process.env,
1717
shell: true,
@@ -23,7 +23,7 @@ function recompileFromSource() {
2323
return;
2424
}
2525

26-
spawn = child_process.spawnSync('npm', ['run', 'build:bindings'], {
26+
spawn = child_process.spawnSync('npm run build:bindings', {
2727
stdio: ['inherit', 'inherit', 'pipe'],
2828
env: process.env,
2929
shell: true,

packages/profiling-node/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> =
430430
consoleSandbox(() => {
431431
// eslint-disable-next-line no-console
432432
console.warn(
433-
`[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION}).`,
433+
`[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_VERSION.major}.${NODE_VERSION.minor}.${NODE_VERSION.patch}).`,
434434
'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22.',
435435
'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',
436436
'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',

0 commit comments

Comments
 (0)