Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration-tests/init.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ function testRuntimeVersionChecks (arg, filename) {
it('should not initialize the tracer', () =>
doTest(`Aborting application instrumentation due to incompatible_runtime.
Found incompatible runtime Node.js ${process.versions.node}, Supported runtimes: Node.js \
>=18.
${engines.node}.
false
`, telemetryAbort))

it('should initialize the tracer, if DD_INJECT_FORCE', () =>
doTestForced(`Aborting application instrumentation due to incompatible_runtime.
Found incompatible runtime Node.js ${process.versions.node}, Supported runtimes: Node.js \
>=18.
${engines.node}.
DD_INJECT_FORCE enabled, allowing unsupported runtimes and continuing.
Application instrumentation bootstrapping complete
true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
},
"homepage": "https://github.com/DataDog/dd-trace-js#readme",
"engines": {
"node": ">=18"
"node": ">=18 <26"
},
"files": [
"ci/**/*",
Expand Down
6 changes: 4 additions & 2 deletions packages/dd-trace/src/guardrails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ function guard (fn) {
var clobberBailout = false
var forced = isTrue(process.env.DD_INJECT_FORCE)
var engines = require('../../../../package.json').engines
var minMajor = parseInt(engines.node.replace(/[^0-9]/g, ''))
var majors = engines.node.match(/\d+/)
var minMajor = parseInt(majors[0])
var maxMajor = parseInt(majors[1])
var version = process.versions.node

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

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