Skip to content

Commit 694c185

Browse files
committed
fix: enforced Node.js 18.19 as the minimum supported version (#2151)
BREAKING CHANGE: Dropped support for Node.js versions below 18.19
1 parent e0961ce commit 694c185

File tree

17 files changed

+47
-21
lines changed

17 files changed

+47
-21
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"license": "MIT",
2121
"engines": {
22-
"node": ">=18.0.0"
22+
"node": ">=18.19.0"
2323
},
2424
"contributors": [
2525
{

packages/autoprofile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"semver": "^7.7.3"
5757
},
5858
"engines": {
59-
"node": ">=18.0.0"
59+
"node": ">=18.19.0"
6060
},
6161
"main": "index.js",
6262
"files": [

packages/aws-fargate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@
7171
"@instana/serverless": "4.30.1"
7272
},
7373
"engines": {
74-
"node": ">=18.0.0"
74+
"node": ">=18.19.0"
7575
}
7676
}

packages/aws-lambda/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"tracing"
4949
],
5050
"engines": {
51-
"node": ">=18.0.0"
51+
"node": ">=18.19.0"
5252
},
5353
"contributors": [
5454
{

packages/azure-container-services/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"url": "https://github.com/instana/nodejs/issues"
6363
},
6464
"engines": {
65-
"node": ">=18.0.0"
65+
"node": ">=18.19.0"
6666
},
6767
"license": "MIT",
6868
"dependencies": {

packages/collector/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"url": "git+https://github.com/instana/nodejs.git"
3232
},
3333
"engines": {
34-
"node": ">=18.0.0"
34+
"node": ">=18.19.0"
3535
},
3636
"scripts": {
3737
"audit": "npm audit --omit=dev",

packages/core/src/tracing/instrumentation/protocols/nativeFetch.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ let isActive = false;
3333
exports.shouldAddHeadersToOptionsUnconditionally = function () {
3434
return (
3535
semver.eq(process.version, '21.0.0') ||
36-
(semver.gte(process.version, '20.8.1') && semver.lt(process.version, '20.10.0')) ||
37-
(semver.gte(process.version, '18.18.2') && semver.lt(process.version, '18.19.0'))
36+
(semver.gte(process.version, '20.8.1') && semver.lt(process.version, '20.10.0'))
3837
);
3938
};
4039

packages/core/src/util/nodeJsVersionCheck.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
'use strict';
66

7+
const semver = require('semver');
78
/**
89
* This is the minimum required Node.js version for all @instana packages.
910
*/
10-
exports.minimumNodeJsVersion = 18;
11+
exports.minimumNodeJsVersion = '18.19.0';
1112

1213
/**
1314
* Checks if the value of process.version denotes a Node.js version that is not supported, that is, older than the given
@@ -17,12 +18,9 @@ exports.minimumNodeJsVersion = 18;
1718
*/
1819
exports.isNodeJsTooOld = function isNodeJsTooOld() {
1920
const currentVersion = process.version;
20-
if (typeof currentVersion === 'string') {
21-
const majorVersionStr = process.version.split('.')[0];
22-
if (majorVersionStr.length > 1 && majorVersionStr.charAt(0) === 'v') {
23-
const majorVersion = parseInt(majorVersionStr.substring(1), 10);
24-
return !isNaN(majorVersion) && majorVersion < exports.minimumNodeJsVersion;
25-
}
21+
if (!semver.valid(currentVersion)) {
22+
return false;
2623
}
27-
return false;
24+
25+
return semver.lt(currentVersion, exports.minimumNodeJsVersion);
2826
};

packages/core/test/tracing/supportedVersion_test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ const supportedTracingVersion = require('../../src/tracing/supportedVersion');
1111

1212
describe('supported versions for Node.js auto tracing', () => {
1313
it('must support various Node.js versions', () => {
14-
expect(supportedTracingVersion('18.1.1')).to.equal(true);
14+
expect(supportedTracingVersion('18.19.0')).to.equal(true);
1515
expect(supportedTracingVersion('20.0.0')).to.equal(true);
1616
expect(supportedTracingVersion('21.2.0')).to.equal(true);
1717
expect(supportedTracingVersion('22.0.0')).to.equal(true);
1818
expect(supportedTracingVersion('23.0.0')).to.equal(true);
1919
expect(supportedTracingVersion('24.0.0')).to.equal(true);
20+
expect(supportedTracingVersion('25.0.0')).to.equal(true);
2021
});
2122

2223
it('must report various Node.js versions as not supported', () => {
@@ -45,5 +46,6 @@ describe('supported versions for Node.js auto tracing', () => {
4546
expect(supportedTracingVersion('12.0.0')).to.equal(false);
4647
expect(supportedTracingVersion('14.0.0')).to.equal(false);
4748
expect(supportedTracingVersion('16.1.0')).to.equal(false);
49+
expect(supportedTracingVersion('18.18.0')).to.equal(false);
4850
});
4951
});

packages/core/test/util/nodeJsTooOld_test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ describe('util.nodeJsTooOld', () => {
7777
expect(isNodeJsTooOld()).to.be.true;
7878
});
7979

80+
it('should reject Node.js 18.18.0', () => {
81+
setProcessVersion('v18.18.0');
82+
expect(isNodeJsTooOld()).to.be.true;
83+
});
84+
85+
it('should reject Node.js 18.18.9', () => {
86+
setProcessVersion('v18.18.0');
87+
expect(isNodeJsTooOld()).to.be.true;
88+
});
89+
90+
it('should accept Node.js 18.19.0', () => {
91+
setProcessVersion('v18.19.0');
92+
expect(isNodeJsTooOld()).to.be.false;
93+
});
94+
8095
it('should accept if process.version is not set', () => {
8196
setProcessVersion(undefined);
8297
expect(isNodeJsTooOld()).to.be.false;
@@ -94,7 +109,7 @@ describe('util.nodeJsTooOld', () => {
94109

95110
it('should accept if process.version is in an unexpected format (no v prefix)', () => {
96111
setProcessVersion('11.22.33');
97-
expect(isNodeJsTooOld()).to.be.false;
112+
expect(isNodeJsTooOld()).to.be.true;
98113
});
99114
});
100115

0 commit comments

Comments
 (0)