Skip to content

Commit 847daf0

Browse files
authored
feat(profiling): Add support for Node v24 in the prune script (#18447)
(closes #18428) (closes [JS-1266](https://linear.app/getsentry/issue/JS-1266/sentry-prune-profiler-binaries-does-not-recognize-nodejs-24-as-a-valid)) This adds support for Node v24 in the prune script. On top this also adds a test that is testing against the current Node version (as suggested in #14491 (review)). Since we have [a matrix](https://github.com/getsentry/sentry-javascript/blob/a906759fd8769d264498598dc16dab8af26377ea/.github/workflows/build.yml#L747) for our integration tests, this test would fail once we add Node v26 - where we are forced to update the ABI manually. Theoretically we could also use [node-abi](https://www.npmjs.com/package/node-abi), but decided against it to keep the dependencies low.
1 parent 5c5c7d4 commit 847daf0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

packages/profiling-node/scripts/prune-profiler-binaries.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const NODE_TO_ABI = {
6363
18: '108',
6464
20: '115',
6565
22: '127',
66+
24: '134',
6667
};
6768

6869
if (NODE) {
@@ -76,6 +77,8 @@ if (NODE) {
7677
NODE = NODE_TO_ABI['20'];
7778
} else if (NODE.startsWith('22')) {
7879
NODE = NODE_TO_ABI['22'];
80+
} else if (NODE.startsWith('24')) {
81+
NODE = NODE_TO_ABI['24'];
7982
} else {
8083
ARGV_ERRORS.push(
8184
`❌ Sentry: Invalid node version passed as argument, please make sure --target_node is a valid major node version. Supported versions are ${Object.keys(
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { spawnSync } from 'node:child_process';
2+
import * as os from 'node:os';
3+
import * as path from 'node:path';
4+
import { describe, expect, it } from 'vitest';
5+
6+
describe('prune-profiler-binaries', () => {
7+
it('should check if the node version is valid', () => {
8+
const currentNode = process.version.split('v')[1];
9+
const result = spawnSync(
10+
'node',
11+
[
12+
path.join(__dirname, '../scripts/prune-profiler-binaries.js'),
13+
'--target_platform=linux',
14+
'--target_arch=x64',
15+
'--target_stdlib=glibc',
16+
`--target_dir_path=${os.tmpdir()}`,
17+
`--target_node=${currentNode}`,
18+
],
19+
{ encoding: 'utf8' },
20+
);
21+
22+
expect(result.stdout).not.toContain('Invalid node version passed as argument');
23+
});
24+
});

0 commit comments

Comments
 (0)