Skip to content

Commit cb7c080

Browse files
feat!: Dropped support for Node.js 18 (#3097)
1 parent 82d9689 commit cb7c080

File tree

57 files changed

+139
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+139
-235
lines changed

.github/workflows/benchmark-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
node-version: [18.x, 20.x, 22.x, 24.x]
19+
node-version: [20.x, 22.x, 24.x]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/ci-workflow.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
strategy:
104104
fail-fast: false
105105
matrix:
106-
node-version: [18.x, 20.x, 22.x, 24.x]
106+
node-version: [20.x, 22.x, 24.x]
107107

108108
steps:
109109
- uses: actions/checkout@v4
@@ -135,7 +135,7 @@ jobs:
135135
strategy:
136136
fail-fast: false
137137
matrix:
138-
node-version: [18.x, 20.x, 22.x, 24.x]
138+
node-version: [20.x, 22.x, 24.x]
139139

140140
steps:
141141
- uses: actions/checkout@v4
@@ -171,7 +171,7 @@ jobs:
171171
strategy:
172172
fail-fast: false
173173
matrix:
174-
node-version: [18.x, 20.x, 22.x, 24.x]
174+
node-version: [20.x, 22.x, 24.x]
175175

176176
steps:
177177
- uses: actions/checkout@v4
@@ -222,7 +222,7 @@ jobs:
222222
strategy:
223223
fail-fast: false
224224
matrix:
225-
node-version: [18.x, 20.x, 22.x, 24.x]
225+
node-version: [20.x, 22.x, 24.x]
226226

227227
steps:
228228
- uses: actions/checkout@v4
@@ -245,7 +245,7 @@ jobs:
245245

246246
strategy:
247247
matrix:
248-
node-version: [18.x, 20.x, 22.x, 24.x]
248+
node-version: [20.x, 22.x, 24.x]
249249

250250
steps:
251251
- uses: actions/checkout@v4

.github/workflows/smoke-test-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
strategy:
2626
matrix:
27-
node-version: [18.x, 20.x, 22.x, 24.x]
27+
node-version: [20.x, 22.x, 24.x]
2828

2929
steps:
3030
- uses: actions/checkout@v4

.github/workflows/versioned-security-agent.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
strategy:
6767
fail-fast: false
6868
matrix:
69-
node-version: [18.x, 20.x, 22.x, 24.x]
69+
node-version: [20.x, 22.x, 24.x]
7070

7171
steps:
7272
- uses: actions/checkout@v4

THIRD_PARTY_NOTICES.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
8282

8383
**[optionalDependencies](#optionalDependencies)**
8484

85-
* [@contrast/fn-inspect](#contrastfn-inspect)
85+
* [@newrelic/fn-inspect](#newrelicfn-inspect)
8686
* [@newrelic/native-metrics](#newrelicnative-metrics)
8787
* [@prisma/prisma-fmt-wasm](#prismaprisma-fmt-wasm)
8888

@@ -95,7 +95,7 @@ code, the source code can be found at [https://github.com/newrelic/node-newrelic
9595

9696
### @grpc/grpc-js
9797

98-
This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.4](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.13.4)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.13.4/LICENSE):
98+
This product includes source derived from [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js) ([v1.13.3](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/tree/v1.13.3)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js/blob/v1.13.3/LICENSE):
9999

100100
```
101101
Apache License
@@ -1902,7 +1902,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19021902

19031903
### import-in-the-middle
19041904

1905-
This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.14.0](https://github.com/nodejs/import-in-the-middle/tree/v1.14.0)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.14.0/LICENSE):
1905+
This product includes source derived from [import-in-the-middle](https://github.com/nodejs/import-in-the-middle) ([v1.13.2](https://github.com/nodejs/import-in-the-middle/tree/v1.13.2)), distributed under the [Apache-2.0 License](https://github.com/nodejs/import-in-the-middle/blob/v1.13.2/LICENSE):
19061906

19071907
```
19081908
Apache License
@@ -2333,7 +2333,7 @@ SOFTWARE.
23332333

23342334
### @aws-sdk/client-s3
23352335

2336-
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
2336+
This product includes source derived from [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3) ([v3.808.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.808.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.808.0/LICENSE):
23372337

23382338
```
23392339
Apache License
@@ -2542,7 +2542,7 @@ This product includes source derived from [@aws-sdk/client-s3](https://github.co
25422542

25432543
### @aws-sdk/s3-request-presigner
25442544

2545-
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.821.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.821.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.821.0/LICENSE):
2545+
This product includes source derived from [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3) ([v3.808.0](https://github.com/aws/aws-sdk-js-v3/tree/v3.808.0)), distributed under the [Apache-2.0 License](https://github.com/aws/aws-sdk-js-v3/blob/v3.808.0/LICENSE):
25462546

25472547
```
25482548
Apache License
@@ -4370,7 +4370,7 @@ SOFTWARE.
43704370

43714371
### eslint-plugin-jsdoc
43724372

4373-
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.7.1](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.7.1)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.7.1/LICENSE):
4373+
This product includes source derived from [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) ([v50.6.14](https://github.com/gajus/eslint-plugin-jsdoc/tree/v50.6.14)), distributed under the [BSD-3-Clause License](https://github.com/gajus/eslint-plugin-jsdoc/blob/v50.6.14/LICENSE):
43744374

43754375
```
43764376
Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
@@ -4402,7 +4402,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44024402

44034403
### eslint
44044404

4405-
This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.28.0](https://github.com/eslint/eslint/tree/v9.28.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.28.0/LICENSE):
4405+
This product includes source derived from [eslint](https://github.com/eslint/eslint) ([v9.26.0](https://github.com/eslint/eslint/tree/v9.26.0)), distributed under the [MIT License](https://github.com/eslint/eslint/blob/v9.26.0/LICENSE):
44064406

44074407
```
44084408
Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
@@ -5235,9 +5235,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52355235

52365236
## optionalDependencies
52375237

5238-
### @contrast/fn-inspect
5238+
### @newrelic/fn-inspect
52395239

5240-
This product includes source derived from [@contrast/fn-inspect](https://github.com/Contrast-Security-Inc/node-fn-inspect) ([v4.3.0](https://github.com/Contrast-Security-Inc/node-fn-inspect/tree/v4.3.0)), distributed under the [MIT License](https://github.com/Contrast-Security-Inc/node-fn-inspect/blob/v4.3.0/LICENSE):
5240+
This product includes source derived from [@newrelic/fn-inspect](https://github.com/newrelic-forks/node-fn-inspect) ([v4.4.0](https://github.com/newrelic-forks/node-fn-inspect/tree/v4.4.0)), distributed under the [MIT License](https://github.com/newrelic-forks/node-fn-inspect/blob/v4.4.0/LICENSE):
52415241

52425242
```
52435243
Copyright 2022 Contrast Security, Inc

lib/environment.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const logger = require('./logger').child({ component: 'environment' })
1212
const stringify = require('json-stringify-safe')
1313
const asyncEachLimit = require('./util/async-each-limit')
1414
const DISPATCHER_VERSION = 'Dispatcher Version'
15-
const semver = require('semver')
1615

1716
// As of 1.7.0 you can no longer dynamically link v8
1817
// https://github.com/nodejs/io.js/commit/d726a177ed
@@ -293,19 +292,17 @@ function remapConfigSettings() {
293292
}
294293
})
295294

296-
maybeAddMissingProcessVars()
295+
addMissingProcessVars()
297296
}
298297
}
299298

300299
/**
301300
* As of Node 19 DTrace and ETW are no longer bundled
302301
* see: https://nodejs.org/en/blog/announcements/v19-release-announce#dtrace/systemtap/etw-support
303302
*/
304-
function maybeAddMissingProcessVars() {
305-
if (semver.gte(process.version, '19.0.0')) {
306-
addSetting(remapping.node_use_dtrace, 'no')
307-
addSetting(remapping.node_use_etw, 'no')
308-
}
303+
function addMissingProcessVars() {
304+
addSetting(remapping.node_use_dtrace, 'no')
305+
addSetting(remapping.node_use_etw, 'no')
309306
}
310307

311308
async function getOtherPackages() {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
],
152152
"homepage": "https://github.com/newrelic/node-newrelic",
153153
"engines": {
154-
"node": ">=18",
154+
"node": ">=20",
155155
"npm": ">=6.0.0"
156156
},
157157
"directories": {
@@ -224,7 +224,7 @@
224224
},
225225
"optionalDependencies": {
226226
"@newrelic/fn-inspect": "^4.4.0",
227-
"@newrelic/native-metrics": "^11.1.0",
227+
"@newrelic/native-metrics": "^12.0.0",
228228
"@prisma/prisma-fmt-wasm": "^4.17.0-16.27eb2449f178cd9fe1a4b892d732cc4795f75085"
229229
},
230230
"devDependencies": {
@@ -234,7 +234,7 @@
234234
"@matteo.collina/tspl": "^0.1.1",
235235
"@newrelic/eslint-config": "^0.5.0",
236236
"@newrelic/newrelic-oss-cli": "^0.1.2",
237-
"@newrelic/test-utilities": "^9.1.0",
237+
"@newrelic/test-utilities": "^10.0.0",
238238
"@octokit/rest": "^18.0.15",
239239
"@slack/bolt": "^3.7.0",
240240
"@smithy/eventstream-codec": "^2.2.0",

test/integration/uninstrumented/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"when": "*"
2727
},
2828
"engines": {
29-
"node": ">=18"
29+
"node": ">=20"
3030
}
3131
}

test/unit/environment.test.js

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const { spawn } = require('node:child_process')
1515
// environment when testing.
1616
delete process.env.NODE_ENV
1717

18-
const { isSupportedVersion } = require('../lib/agent_helper')
1918
const environment = require('../../lib/environment')
2019

2120
function find(settings, name) {
@@ -128,67 +127,6 @@ test('with process.config', (t) => {
128127
)
129128
})
130129

131-
// TODO: remove tests when we drop support for node 18
132-
test('without process.config', { skip: isSupportedVersion('v19.0.0') }, async (t) => {
133-
t.beforeEach(async (ctx) => {
134-
ctx.nr.conf = { ...process.config }
135-
136-
/**
137-
* TODO: Augmenting process.config has been deprecated in Node 16.
138-
* When fully disabled we may no-longer be able to test but also may no-longer need to.
139-
* https://nodejs.org/api/deprecations.html#DEP0150
140-
*/
141-
process.config = null
142-
143-
ctx.nr.settings = await environment.getJSON()
144-
})
145-
146-
t.afterEach(async (ctx) => {
147-
process.config = { ...ctx.nr.conf }
148-
ctx.nr.settings = await environment.getJSON()
149-
})
150-
151-
await t.test('assertions without process.config', (t) => {
152-
const { settings } = t.nr
153-
assert.equal(
154-
find(settings, 'npm installed?'),
155-
undefined,
156-
'should not know whether npm was installed with Node.js'
157-
)
158-
assert.equal(
159-
find(settings, 'WAF build system installed?'),
160-
undefined,
161-
'should not know whether WAF was installed with Node.js'
162-
)
163-
assert.equal(
164-
find(settings, 'OpenSSL support?'),
165-
undefined,
166-
'should not know whether OpenSSL support was compiled into Node.js'
167-
)
168-
assert.equal(
169-
find(settings, 'Dynamically linked to OpenSSL?'),
170-
undefined,
171-
'Dynamically linked to OpenSSL?'
172-
)
173-
assert.equal(
174-
find(settings, 'Dynamically linked to V8?'),
175-
undefined,
176-
'Dynamically linked to V8?'
177-
)
178-
assert.equal(
179-
find(settings, 'Dynamically linked to Zlib?'),
180-
undefined,
181-
'Dynamically linked to Zlib?'
182-
)
183-
assert.equal(find(settings, 'DTrace support?'), undefined, 'DTrace support?')
184-
assert.equal(
185-
find(settings, 'Event Tracing for Windows (ETW) support?'),
186-
undefined,
187-
'Event Tracing for Windows (ETW) support?'
188-
)
189-
})
190-
})
191-
192130
test('should have built a flattened package list', (t) => {
193131
const { settings } = t.nr
194132
const packages = find(settings, 'Packages')
@@ -222,19 +160,6 @@ test('should get correct version for dependencies', async () => {
222160
})
223161
})
224162

225-
// TODO: remove this test when we drop support for node 18
226-
test(
227-
'should resolve refresh where deps and deps of deps are symlinked to each other',
228-
{ skip: isSupportedVersion('v19.0.0') },
229-
async () => {
230-
process.config.variables.node_prefix = path.join(__dirname, '../lib/example-deps')
231-
const data = await environment.getJSON()
232-
const pkgs = find(data, 'Dependencies')
233-
const customPkgs = pkgs.filter((pkg) => pkg.includes('custom-pkg'))
234-
assert.equal(customPkgs.length, 3)
235-
}
236-
)
237-
238163
test('should not crash when given a file in NODE_PATH', (t, end) => {
239164
const env = {
240165
NODE_PATH: path.join(__dirname, 'environment.test.js'),

test/unit/util/hashes.test.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const test = require('node:test')
1111
const testData = require('../../lib/obfuscation-data')
1212
const hashes = require('../../../lib/util/hashes')
1313

14-
const major = process.version.slice(1).split('.').map(Number).shift()
15-
1614
test('#makeId always returns the correct length', () => {
1715
for (let length = 4; length < 64; length++) {
1816
for (let attempts = 0; attempts < 500; attempts++) {
@@ -53,19 +51,3 @@ test('deobfuscation', async (t) => {
5351
}
5452
})
5553
})
56-
57-
// TODO: remove this test when we drop support for node 18
58-
test('getHash', { skip: major > 18 }, async (t) => {
59-
/**
60-
* TODO: crypto.DEFAULT_ENCODING has been deprecated.
61-
* When fully disabled, this test can likely be removed.
62-
* https://nodejs.org/api/deprecations.html#DEP0091
63-
*/
64-
await t.test('should not crash when changing the DEFAULT_ENCODING key on crypto', () => {
65-
const crypto = require('node:crypto')
66-
const oldEncoding = crypto.DEFAULT_ENCODING
67-
crypto.DEFAULT_ENCODING = 'utf-8'
68-
assert.doesNotThrow(hashes.getHash.bind(null, 'TEST_APP', 'TEST_TXN'))
69-
crypto.DEFAULT_ENCODING = oldEncoding
70-
})
71-
})

0 commit comments

Comments
 (0)