Skip to content

Commit

Permalink
Merge pull request #364 from newrelic/NR-141651/add-node-20
Browse files Browse the repository at this point in the history
feat: Added support for Node 20
  • Loading branch information
mrickard authored Nov 30, 2023
2 parents 4f7a26f + 07264f3 commit b0de90a
Show file tree
Hide file tree
Showing 28 changed files with 218 additions and 46 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ This plugin currently supports the following AWS runtimes:
- nodejs14.x
- nodejs16.x
- nodejs18.x
- nodejs20.x
- python3.7
- python3.8
- python3.9
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-newrelic-lambda-layers",
"version": "4.2.0",
"version": "4.3.0",
"description": "Serverless plugin for NewRelic APM AWS Lambda layers.",
"main": "dist/index.js",
"files": [
Expand Down Expand Up @@ -55,7 +55,7 @@
"lodash": "^4.17.21",
"node-fetch": "^2.6.7",
"path": "^0.12.7",
"semver": "^7.3.5",
"semver": "^7.5.4",
"serverless": "^3.19.0"
},
"keywords": [
Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const wrappableRuntimeList = [
"nodejs14.x",
"nodejs16.x",
"nodejs18.x",
"nodejs20.x",
"python3.7",
"python3.8",
"python3.9",
Expand Down Expand Up @@ -750,7 +751,11 @@ or make sure that you already have Serverless 3.x installed in your project.
}

private getHandlerWrapper(runtime: string, handler: string) {
if (["nodejs14.x", "nodejs16.x", "nodejs18.x"].indexOf(runtime) !== -1) {
if (
["nodejs14.x", "nodejs16.x", "nodejs18.x", "nodejs20.x"].indexOf(
runtime
) !== -1
) {
return "newrelic-lambda-wrapper.handler";
}

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/arm64.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16XARM64:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16XARM64:76"
],
"package": {
"exclude": [
Expand Down Expand Up @@ -52,7 +52,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18XARM64:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18XARM64:51"
],
"package": {
"exclude": [
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/debug-log-level.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -54,7 +54,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/debug.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -75,7 +75,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -50,7 +50,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/eu.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -55,7 +55,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/function-has-layers.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"service": "newrelic-lambda-layers-nodejs-example",
"provider": {
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"name": "aws",
"stage": "prod",
Expand Down Expand Up @@ -46,7 +46,7 @@
"runtime": "nodejs18.x",
"layers": [
"arn:aws:lambda:us-east-1:123456789012:layer:SomeOtherLayer:1",
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
]
},
"layer-nodejs18x2": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/include.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": { "exclude": [
"./**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"service": "newrelic-lambda-layers-nodejs-example",
"provider": {
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"name": "aws",
"stage": "prod",
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/lambda-extension-disabled.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -49,7 +49,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/lambda-extension-enabled.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -47,7 +47,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": [
Expand Down Expand Up @@ -53,7 +53,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": [
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/log-disabled.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -50,7 +50,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": [
Expand Down Expand Up @@ -57,7 +57,7 @@
],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": [
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/log-level.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:72"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS16X:76"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand All @@ -53,7 +53,7 @@
"events": [{ "schedule": "rate(5 minutes)" }],
"handler": "newrelic-lambda-wrapper.handler",
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"package": {
"exclude": ["./**", "!newrelic-wrapper-helper.js"],
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/manual-wrapping.output.service.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
],
"provider": {
"layers": [
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:47"
"arn:aws:lambda:us-east-1:451483290750:layer:NewRelicNodeJS18X:51"
],
"name": "aws",
"region": "us-east-1",
Expand Down
80 changes: 80 additions & 0 deletions tests/fixtures/node-versions.input.service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"service": "newrelic-lambda-layers-nodejs-example",
"provider": {
"name": "aws",
"stage": "prod",
"region": "us-east-1",
"stackTags": {
"environment": "us-testing",
"owning_team": "LAMBDA",
"product": "aws-lambda"
},
"tags": {
"environment": "us-testing",
"owning_team": "LAMBDA",
"product": "aws-lambda"
}
},
"plugins": [
"serverless-newrelic-lambda-layers"
],
"custom": {
"newRelic": {
"accountId": "${env:NEW_RELIC_ACCOUNT_ID}",
"apiKey": "${env:NEW_RELIC_PERSONAL_API_KEY}"
}
},
"functions": {
"layer-nodejs16x": {
"events": [
{
"schedule": "rate(5 minutes)"
}
],
"handler": "handler.handler",
"package": {
"exclude": [
"./**"
],
"include": [
"handler.js"
]
},
"runtime": "nodejs16.x"
},
"layer-nodejs18x": {
"events": [
{
"schedule": "rate(5 minutes)"
}
],
"handler": "handler.handler",
"package": {
"exclude": [
"./**"
],
"include": [
"handler.js"
]
},
"runtime": "nodejs18.x"
},
"layer-nodejs20x": {
"events": [
{
"schedule": "rate(5 minutes)"
}
],
"handler": "handler.handler",
"package": {
"exclude": [
"./**"
],
"include": [
"handler.js"
]
},
"runtime": "nodejs20.x"
}
}
}
Loading

0 comments on commit b0de90a

Please sign in to comment.