Skip to content

Commit 664de73

Browse files
committed
add maximum node version in guardrails
1 parent 537a4a7 commit 664de73

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
},
9494
"homepage": "https://github.com/DataDog/dd-trace-js#readme",
9595
"engines": {
96-
"node": ">=18"
96+
"node": ">=18 <26"
9797
},
9898
"files": [
9999
"ci/**/*",

packages/dd-trace/src/guardrails/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ function guard (fn) {
1414
var clobberBailout = false
1515
var forced = isTrue(process.env.DD_INJECT_FORCE)
1616
var engines = require('../../../../package.json').engines
17-
var minMajor = parseInt(engines.node.replace(/[^0-9]/g, ''))
17+
var majors = engines.node.match(/\d+/)
18+
var minMajor = parseInt(majors[0])
19+
var maxMajor = parseInt(majors[1])
1820
var version = process.versions.node
1921

2022
if (process.env.DD_INJECTION_ENABLED) {
@@ -40,7 +42,7 @@ function guard (fn) {
4042

4143
// If the runtime doesn't match the engines field in package.json, then we
4244
// should not initialize the tracer.
43-
if (!clobberBailout && NODE_MAJOR < minMajor) {
45+
if (!clobberBailout && (NODE_MAJOR < minMajor || NODE_MAJOR > maxMajor)) {
4446
initBailout = true
4547
telemetry([
4648
{ name: 'abort', tags: ['reason:incompatible_runtime'] },

0 commit comments

Comments
 (0)