diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e5787a6..75377663 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: strategy: max-parallel: 4 matrix: - node-version: [14, 16] + node-version: [16, 18] steps: - name: Checkout diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 33e83b1f..c65172ed 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -10,10 +10,10 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Set up Node 14 + - name: Set up Node 18 uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 18 - name: Cache Node modules id: cache-node-modules diff --git a/integration_tests/correct_extension_apigateway_snapshot.json b/integration_tests/correct_extension_apigateway_snapshot.json index 32f26541..ee03113f 100644 --- a/integration_tests/correct_extension_apigateway_snapshot.json +++ b/integration_tests/correct_extension_apigateway_snapshot.json @@ -89,12 +89,6 @@ "LogGroupName": "/aws/lambda/dd-sls-plugin-integration-test-dev-PythonHello39" } }, - "JavascriptHello14DashxLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/dd-sls-plugin-integration-test-dev-JavascriptHello14-x" - } - }, "JavascriptHello16DashxLogGroup": { "Type": "AWS::Logs::LogGroup", "Properties": { @@ -382,56 +376,6 @@ "PythonHello39LogGroup" ] }, - "JavascriptHello14DashxLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/dd-sls-plugin-integration-test/dev/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX/dd-sls-plugin-integration-test.zip" - }, - "Handler": "/opt/nodejs/node_modules/datadog-lambda-js/handler.handler", - "Runtime": "nodejs14.x", - "FunctionName": "dd-sls-plugin-integration-test-dev-JavascriptHello14-x", - "MemorySize": 1024, - "Timeout": 6, - "Tags": [ - { - "Key": "dd_sls_plugin", - "Value": "vX.XX.X" - } - ], - "Environment": { - "Variables": { - "DD_API_KEY": 1234, - "DD_SITE": "datadoghq.com", - "DD_LOG_LEVEL": "info", - "DD_TRACE_ENABLED": true, - "DD_MERGE_XRAY_TRACES": false, - "DD_LOGS_INJECTION": false, - "DD_SERVERLESS_LOGS_ENABLED": true, - "DD_CAPTURE_LAMBDA_PAYLOAD": false, - "DD_SERVICE": "dd-sls-plugin-integration-test", - "DD_ENV": "dev", - "DD_LAMBDA_HANDLER": "js_handler.hello" - } - }, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Layers": [ - "arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node14-x:XXX", - "arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Extension:XXX" - ] - }, - "DependsOn": [ - "JavascriptHello14DashxLogGroup" - ] - }, "JavascriptHello16DashxLambdaFunction": { "Type": "AWS::Lambda::Function", "Properties": { @@ -859,16 +803,6 @@ "CodeSha256": "XXXX" } }, - "JavascriptHello14DashxLambdaVersionXXXX": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", - "Properties": { - "FunctionName": { - "Ref": "JavascriptHello14DashxLambdaFunction" - }, - "CodeSha256": "XXXX" - } - }, "JavascriptHello16DashxLambdaVersionXXXX": { "Type": "AWS::Lambda::Version", "DeletionPolicy": "Retain", @@ -1065,7 +999,7 @@ ":lambda:path/2015-03-31/functions/", { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -1077,7 +1011,7 @@ "MethodResponses": [] }, "DependsOn": [ - "JavascriptHello14DashxLambdaPermissionApiGateway" + "JavascriptHello16DashxLambdaPermissionApiGateway" ] }, "ApiGatewayDeploymentxxxx": { @@ -1130,12 +1064,12 @@ } } }, - "JavascriptHello14DashxLambdaPermissionApiGateway": { + "JavascriptHello16DashxLambdaPermissionApiGateway": { "Type": "AWS::Lambda::Permission", "Properties": { "FunctionName": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -1335,7 +1269,7 @@ } } }, - "JavascriptHello14DashxWebsocketsIntegration": { + "JavascriptHello16DashxWebsocketsIntegration": { "Type": "AWS::ApiGatewayV2::Integration", "Properties": { "ApiId": { @@ -1357,7 +1291,7 @@ ":lambda:path/2015-03-31/functions/", { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -1384,16 +1318,16 @@ "Principal": "apigateway.amazonaws.com" } }, - "JavascriptHello14DashxLambdaPermissionWebsockets": { + "JavascriptHello16DashxLambdaPermissionWebsockets": { "Type": "AWS::Lambda::Permission", "DependsOn": [ "WebsocketsApi", - "JavascriptHello14DashxLambdaFunction" + "JavascriptHello16DashxLambdaFunction" ], "Properties": { "FunctionName": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -1415,7 +1349,7 @@ [ "integrations", { - "Ref": "JavascriptHello14DashxWebsocketsIntegration" + "Ref": "JavascriptHello16DashxWebsocketsIntegration" } ] ] @@ -1441,7 +1375,7 @@ "Format": "$context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime] \"$context.eventType $context.routeKey $context.connectionId\" $context.requestId" }, "DeploymentId": { - "Ref": "WebsocketsDeploymentckqcOE1ebmlhFFRpE7NMKPybd4S9QPf1rsPjkB0NjI" + "Ref": "WebsocketsDeploymentLprF7rCGSeh3kyAZfYGKU0tnNqO18rZ6K6vGaxgc" } } }, @@ -1451,7 +1385,7 @@ "LogGroupName": "/aws/websocket/dd-sls-plugin-integration-test-dev" } }, - "WebsocketsDeploymentckqcOE1ebmlhFFRpE7NMKPybd4S9QPf1rsPjkB0NjI": { + "WebsocketsDeploymentLprF7rCGSeh3kyAZfYGKU0tnNqO18rZ6K6vGaxgc": { "Type": "AWS::ApiGatewayV2::Deployment", "DependsOn": [ "SconnectWebsocketsRoute", @@ -1575,12 +1509,12 @@ }, "DependsOn": "HttpApiIntegrationPythonHello39" }, - "JavascriptHello14DashxLambdaPermissionHttpApi": { + "JavascriptHello16DashxLambdaPermissionHttpApi": { "Type": "AWS::Lambda::Permission", "Properties": { "FunctionName": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -1612,7 +1546,7 @@ } } }, - "HttpApiIntegrationJavascriptHello14Dashx": { + "HttpApiIntegrationJavascriptHello16Dashx": { "Type": "AWS::ApiGatewayV2::Integration", "Properties": { "ApiId": { @@ -1621,7 +1555,7 @@ "IntegrationType": "AWS_PROXY", "IntegrationUri": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -1642,13 +1576,13 @@ [ "integrations", { - "Ref": "HttpApiIntegrationJavascriptHello14Dashx" + "Ref": "HttpApiIntegrationJavascriptHello16Dashx" } ] ] } }, - "DependsOn": "HttpApiIntegrationJavascriptHello14Dashx" + "DependsOn": "HttpApiIntegrationJavascriptHello16Dashx" }, "ApiGatewayLogGroupSubscription": { "Type": "AWS::Logs::SubscriptionFilter", @@ -1717,15 +1651,6 @@ "Name": "sls-dd-sls-plugin-integration-test-dev-PythonHello39LambdaFunctionQualifiedArn" } }, - "JavascriptHello14DashxLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "JavascriptHello14DashxLambdaVersionXXXX" - }, - "Export": { - "Name": "sls-dd-sls-plugin-integration-test-dev-JavascriptHello14DashxLambdaFunctionQualifiedArn" - } - }, "JavascriptHello16DashxLambdaFunctionQualifiedArn": { "Description": "Current Lambda function version", "Value": { @@ -1885,4 +1810,4 @@ } } } -} \ No newline at end of file +} diff --git a/integration_tests/correct_extension_snapshot.json b/integration_tests/correct_extension_snapshot.json index 19b77490..852c66e1 100644 --- a/integration_tests/correct_extension_snapshot.json +++ b/integration_tests/correct_extension_snapshot.json @@ -89,12 +89,6 @@ "LogGroupName": "/aws/lambda/dd-sls-plugin-integration-test-dev-PythonHello39" } }, - "JavascriptHello14DashxLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/dd-sls-plugin-integration-test-dev-JavascriptHello14-x" - } - }, "JavascriptHello16DashxLogGroup": { "Type": "AWS::Logs::LogGroup", "Properties": { @@ -245,7 +239,7 @@ "LayerName": "dd-sls-plugin-integration-test-dev-ProviderLevelLayer", "Description": "It's a text file", "CompatibleRuntimes": [ - "nodejs14.x" + "nodejs20.x" ] } }, @@ -418,58 +412,6 @@ "PythonHello39LogGroup" ] }, - "JavascriptHello14DashxLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/dd-sls-plugin-integration-test/dev/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX/dd-sls-plugin-integration-test.zip" - }, - "Handler": "/opt/nodejs/node_modules/datadog-lambda-js/handler.handler", - "Runtime": "nodejs14.x", - "FunctionName": "dd-sls-plugin-integration-test-dev-JavascriptHello14-x", - "MemorySize": 1024, - "Timeout": 6, - "Tags": [ - { - "Key": "dd_sls_plugin", - "Value": "vX.XX.X" - } - ], - "Environment": { - "Variables": { - "DD_API_KEY": 1234, - "DD_SITE": "datadoghq.com", - "DD_TRACE_ENABLED": true, - "DD_MERGE_XRAY_TRACES": false, - "DD_LOGS_INJECTION": false, - "DD_SERVERLESS_LOGS_ENABLED": true, - "DD_CAPTURE_LAMBDA_PAYLOAD": false, - "DD_SERVICE": "dd-sls-plugin-integration-test", - "DD_ENV": "dev", - "DD_LAMBDA_HANDLER": "js_handler.hello" - } - }, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Layers": [ - { - "Ref": "FunctionLevelLayerLambdaLayer" - }, - "arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node14-x:XXX", - "arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Extension:XXX" - ] - }, - "DependsOn": [ - "JavascriptHello14DashxLogGroup" - ] - }, "JavascriptHello16DashxLambdaFunction": { "Type": "AWS::Lambda::Function", "Properties": { @@ -512,7 +454,7 @@ }, "Layers": [ { - "Ref": "ProviderLevelLayerLambdaLayer" + "Ref": "FunctionLevelLayerLambdaLayer" }, "arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node16-x:XXX", "arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Extension:XXX" @@ -636,7 +578,7 @@ "S3Key": "serverless/dd-sls-plugin-integration-test/dev/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX/dd-sls-plugin-integration-test.zip" }, "Handler": "js_handler.hello", - "Runtime": "nodejs14.x", + "Runtime": "nodejs20.x", "FunctionName": "dd-sls-plugin-integration-test-dev-ExcludeThis", "MemorySize": 1024, "Timeout": 6, @@ -1001,16 +943,6 @@ "CodeSha256": "XXXX" } }, - "JavascriptHello16DashxLambdaVersionXXXX": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", - "Properties": { - "FunctionName": { - "Ref": "JavascriptHello16DashxLambdaFunction" - }, - "CodeSha256": "XXXX" - } - }, "JavascriptHello18DashxLambdaVersionXXXX": { "Type": "AWS::Lambda::Version", "DeletionPolicy": "Retain", @@ -1101,12 +1033,12 @@ "CodeSha256": "XXXX" } }, - "JavascriptHello14DashxLambdaVersionXXXX": { + "JavascriptHello16DashxLambdaVersionXXXX": { "Type": "AWS::Lambda::Version", "DeletionPolicy": "Retain", "Properties": { "FunctionName": { - "Ref": "JavascriptHello14DashxLambdaFunction" + "Ref": "JavascriptHello16DashxLambdaFunction" }, "CodeSha256": "XXXX" } @@ -1132,7 +1064,7 @@ }, "ProviderLevelLayerLambdaLayerHash": { "Description": "Current Lambda layer hash", - "Value": "9fc1163e4a4e81d5019bc0e9d4f63aa54d97576f", + "Value": "92e488e3a52ea108eb5f5b1b8522f1cf22ae9612", "Export": { "Name": "sls-dd-sls-plugin-integration-test-dev-ProviderLevelLayerLambdaLayerHash" } @@ -1194,15 +1126,6 @@ "Name": "sls-dd-sls-plugin-integration-test-dev-PythonHello39LambdaFunctionQualifiedArn" } }, - "JavascriptHello16DashxLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "JavascriptHello16DashxLambdaVersionXXXX" - }, - "Export": { - "Name": "sls-dd-sls-plugin-integration-test-dev-JavascriptHello16DashxLambdaFunctionQualifiedArn" - } - }, "JavascriptHello18DashxLambdaFunctionQualifiedArn": { "Description": "Current Lambda function version", "Value": { @@ -1284,13 +1207,13 @@ "Name": "sls-dd-sls-plugin-integration-test-dev-RubyHello32LambdaFunctionQualifiedArn" } }, - "JavascriptHello14DashxLambdaFunctionQualifiedArn": { + "JavascriptHello16DashxLambdaFunctionQualifiedArn": { "Description": "Current Lambda function version", "Value": { - "Ref": "JavascriptHello14DashxLambdaVersionXXXX" + "Ref": "JavascriptHello16DashxLambdaVersionXXXX" }, "Export": { - "Name": "sls-dd-sls-plugin-integration-test-dev-JavascriptHello14DashxLambdaFunctionQualifiedArn" + "Name": "sls-dd-sls-plugin-integration-test-dev-JavascriptHello16DashxLambdaFunctionQualifiedArn" } } } diff --git a/integration_tests/correct_forwarder_snapshot.json b/integration_tests/correct_forwarder_snapshot.json index 7d50c470..a35f5fe7 100644 --- a/integration_tests/correct_forwarder_snapshot.json +++ b/integration_tests/correct_forwarder_snapshot.json @@ -89,12 +89,6 @@ "LogGroupName": "/aws/lambda/dd-sls-plugin-integration-test-dev-PythonHello39" } }, - "JavascriptHello14DashxLogGroup": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "/aws/lambda/dd-sls-plugin-integration-test-dev-JavascriptHello14-x" - } - }, "JavascriptHello16DashxLogGroup": { "Type": "AWS::Logs::LogGroup", "Properties": { @@ -274,16 +268,6 @@ } } }, - "JavascriptHello14DashxLogGroupSubscription": { - "Type": "AWS::Logs::SubscriptionFilter", - "Properties": { - "DestinationArn": "arn:aws:lambda:us-east-1:000000000000:function:datadog-forwarder", - "FilterPattern": "", - "LogGroupName": { - "Ref": "JavascriptHello14DashxLogGroup" - } - } - }, "JavascriptHello16DashxLogGroupSubscription": { "Type": "AWS::Logs::SubscriptionFilter", "Properties": { @@ -633,61 +617,6 @@ "PythonHello39LogGroup" ] }, - "JavascriptHello14DashxLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/dd-sls-plugin-integration-test/dev/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX/dd-sls-plugin-integration-test.zip" - }, - "Handler": "/opt/nodejs/node_modules/datadog-lambda-js/handler.handler", - "Runtime": "nodejs14.x", - "FunctionName": "dd-sls-plugin-integration-test-dev-JavascriptHello14-x", - "MemorySize": 1024, - "Timeout": 6, - "Tags": [ - { - "Key": "dd_sls_plugin", - "Value": "vX.XX.X" - }, - { - "Key": "service", - "Value": "dd-sls-plugin-integration-test" - }, - { - "Key": "env", - "Value": "dev" - } - ], - "Environment": { - "Variables": { - "DD_SITE": "datadoghq.com", - "DD_LOG_LEVEL": "info", - "DD_FLUSH_TO_LOG": true, - "DD_TRACE_ENABLED": true, - "DD_MERGE_XRAY_TRACES": false, - "DD_LOGS_INJECTION": true, - "DD_SERVERLESS_LOGS_ENABLED": true, - "DD_CAPTURE_LAMBDA_PAYLOAD": false, - "DD_LAMBDA_HANDLER": "js_handler.hello" - } - }, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Layers": [ - "arn:aws:lambda:sa-east-1:464622532012:layer:Datadog-Node14-x:XXX" - ] - }, - "DependsOn": [ - "JavascriptHello14DashxLogGroup" - ] - }, "JavascriptHello16DashxLambdaFunction": { "Type": "AWS::Lambda::Function", "Properties": { @@ -863,7 +792,7 @@ "S3Key": "serverless/dd-sls-plugin-integration-test/dev/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX/dd-sls-plugin-integration-test.zip" }, "Handler": "js_handler.hello", - "Runtime": "nodejs14.x", + "Runtime": "nodejs20.x", "FunctionName": "dd-sls-plugin-integration-test-dev-ExcludeThis", "MemorySize": 1024, "Timeout": 6, @@ -888,7 +817,7 @@ "S3Key": "serverless/dd-sls-plugin-integration-test/dev/XXXXXXXXXXXXX-XXXX-XX-XXXXX:XX:XX.XXXX/dd-sls-plugin-integration-test.zip" }, "Handler": "js_handler.hello", - "Runtime": "nodejs14.x", + "Runtime": "nodejs20.x", "FunctionName": "dd-sls-plugin-integration-test-dev-Exclude-This", "MemorySize": 1024, "Timeout": 6, @@ -1194,16 +1123,6 @@ "CodeSha256": "XXXX" } }, - "JavascriptHello14DashxLambdaVersionXXXX": { - "Type": "AWS::Lambda::Version", - "DeletionPolicy": "Retain", - "Properties": { - "FunctionName": { - "Ref": "JavascriptHello14DashxLambdaFunction" - }, - "CodeSha256": "XXXX" - } - }, "JavascriptHello16DashxLambdaVersionXXXX": { "Type": "AWS::Lambda::Version", "DeletionPolicy": "Retain", @@ -1775,7 +1694,7 @@ ":lambda:path/2015-03-31/functions/", { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -1787,7 +1706,7 @@ "MethodResponses": [] }, "DependsOn": [ - "JavascriptHello14DashxLambdaPermissionApiGateway" + "JavascriptHello16DashxLambdaPermissionApiGateway" ] }, "ApiGatewayDeploymentxxxx": { @@ -1840,12 +1759,12 @@ } } }, - "JavascriptHello14DashxLambdaPermissionApiGateway": { + "JavascriptHello16DashxLambdaPermissionApiGateway": { "Type": "AWS::Lambda::Permission", "Properties": { "FunctionName": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -2045,7 +1964,7 @@ } } }, - "JavascriptHello14DashxWebsocketsIntegration": { + "JavascriptHello16DashxWebsocketsIntegration": { "Type": "AWS::ApiGatewayV2::Integration", "Properties": { "ApiId": { @@ -2067,7 +1986,7 @@ ":lambda:path/2015-03-31/functions/", { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -2094,16 +2013,16 @@ "Principal": "apigateway.amazonaws.com" } }, - "JavascriptHello14DashxLambdaPermissionWebsockets": { + "JavascriptHello16DashxLambdaPermissionWebsockets": { "Type": "AWS::Lambda::Permission", "DependsOn": [ "WebsocketsApi", - "JavascriptHello14DashxLambdaFunction" + "JavascriptHello16DashxLambdaFunction" ], "Properties": { "FunctionName": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -2125,7 +2044,7 @@ [ "integrations", { - "Ref": "JavascriptHello14DashxWebsocketsIntegration" + "Ref": "JavascriptHello16DashxWebsocketsIntegration" } ] ] @@ -2151,7 +2070,7 @@ "Format": "$context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime] \"$context.eventType $context.routeKey $context.connectionId\" $context.requestId" }, "DeploymentId": { - "Ref": "WebsocketsDeploymentckqcOE1ebmlhFFRpE7NMKPybd4S9QPf1rsPjkB0NjI" + "Ref": "WebsocketsDeploymentLprF7rCGSeh3kyAZfYGKU0tnNqO18rZ6K6vGaxgc" } } }, @@ -2161,7 +2080,7 @@ "LogGroupName": "/aws/websocket/dd-sls-plugin-integration-test-dev" } }, - "WebsocketsDeploymentckqcOE1ebmlhFFRpE7NMKPybd4S9QPf1rsPjkB0NjI": { + "WebsocketsDeploymentLprF7rCGSeh3kyAZfYGKU0tnNqO18rZ6K6vGaxgc": { "Type": "AWS::ApiGatewayV2::Deployment", "DependsOn": [ "SconnectWebsocketsRoute", @@ -2269,12 +2188,12 @@ }, "DependsOn": "HttpApiIntegrationPythonHello39" }, - "JavascriptHello14DashxLambdaPermissionHttpApi": { + "JavascriptHello16DashxLambdaPermissionHttpApi": { "Type": "AWS::Lambda::Permission", "Properties": { "FunctionName": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -2306,7 +2225,7 @@ } } }, - "HttpApiIntegrationJavascriptHello14Dashx": { + "HttpApiIntegrationJavascriptHello16Dashx": { "Type": "AWS::ApiGatewayV2::Integration", "Properties": { "ApiId": { @@ -2315,7 +2234,7 @@ "IntegrationType": "AWS_PROXY", "IntegrationUri": { "Fn::GetAtt": [ - "JavascriptHello14DashxLambdaFunction", + "JavascriptHello16DashxLambdaFunction", "Arn" ] }, @@ -2336,13 +2255,13 @@ [ "integrations", { - "Ref": "HttpApiIntegrationJavascriptHello14Dashx" + "Ref": "HttpApiIntegrationJavascriptHello16Dashx" } ] ] } }, - "DependsOn": "HttpApiIntegrationJavascriptHello14Dashx" + "DependsOn": "HttpApiIntegrationJavascriptHello16Dashx" }, "ApiGatewayLogGroupSubscription": { "Type": "AWS::Logs::SubscriptionFilter", @@ -2413,15 +2332,6 @@ "Name": "sls-dd-sls-plugin-integration-test-dev-PythonHello39LambdaFunctionQualifiedArn" } }, - "JavascriptHello14DashxLambdaFunctionQualifiedArn": { - "Description": "Current Lambda function version", - "Value": { - "Ref": "JavascriptHello14DashxLambdaVersionXXXX" - }, - "Export": { - "Name": "sls-dd-sls-plugin-integration-test-dev-JavascriptHello14DashxLambdaFunctionQualifiedArn" - } - }, "JavascriptHello16DashxLambdaFunctionQualifiedArn": { "Description": "Current Lambda function version", "Value": { diff --git a/integration_tests/serverless-extension-apigateway.yml b/integration_tests/serverless-extension-apigateway.yml index 2cb934d8..e3e11465 100644 --- a/integration_tests/serverless-extension-apigateway.yml +++ b/integration_tests/serverless-extension-apigateway.yml @@ -40,9 +40,9 @@ functions: path: /users/update method: put - websocket: $connect - JavascriptHello14-x: + JavascriptHello16-x: handler: js_handler.hello - runtime: nodejs14.x + runtime: nodejs16.x events: - http: path: users/create @@ -51,9 +51,6 @@ functions: path: /users/remove method: delete - websocket: $connect - JavascriptHello16-x: - handler: js_handler.hello - runtime: nodejs16.x JavascriptHello18-x: handler: js_handler.hello runtime: nodejs18.x diff --git a/integration_tests/serverless-extension.yml b/integration_tests/serverless-extension.yml index 48257088..f73e1006 100644 --- a/integration_tests/serverless-extension.yml +++ b/integration_tests/serverless-extension.yml @@ -30,14 +30,11 @@ functions: PythonHello39: handler: py_handler.hello runtime: python3.9 - JavascriptHello14-x: - handler: js_handler.hello - runtime: nodejs14.x - layers: - - { Ref: FunctionLevelLayerLambdaLayer } JavascriptHello16-x: handler: js_handler.hello runtime: nodejs16.x + layers: + - { Ref: FunctionLevelLayerLambdaLayer } JavascriptHello18-x: handler: js_handler.hello runtime: nodejs18.x @@ -46,7 +43,7 @@ functions: runtime: nodejs20.x ExcludeThis: handler: js_handler.hello - runtime: nodejs14.x + runtime: nodejs20.x DotnetHello6: handler: dotnet_handler.hello runtime: dotnet6 @@ -72,7 +69,7 @@ layers: name: ${self:service}-${sls:stage}-ProviderLevelLayer # optional, Deployed Lambda layer name description: It's a text file # optional, Description to publish to AWS compatibleRuntimes: # optional, a list of runtimes this layer is compatible with - - nodejs14.x + - nodejs20.x FunctionLevelLayer: path: FunctionLevelLayer name: ${self:service}-${sls:stage}-FunctionLevelLayer # optional, Deployed Lambda layer name diff --git a/integration_tests/serverless-forwarder.yml b/integration_tests/serverless-forwarder.yml index 5234da83..de89a9d4 100644 --- a/integration_tests/serverless-forwarder.yml +++ b/integration_tests/serverless-forwarder.yml @@ -46,9 +46,9 @@ functions: path: /users/update method: put - websocket: $connect - JavascriptHello14-x: + JavascriptHello16-x: handler: js_handler.hello - runtime: nodejs14.x + runtime: nodejs16.x events: - http: path: users/create @@ -57,9 +57,6 @@ functions: path: /users/remove method: delete - websocket: $connect - JavascriptHello16-x: - handler: js_handler.hello - runtime: nodejs16.x JavascriptHello18-x: handler: js_handler.hello runtime: nodejs18.x @@ -68,10 +65,10 @@ functions: runtime: nodejs20.x ExcludeThis: handler: js_handler.hello - runtime: nodejs14.x + runtime: nodejs20.x Exclude-This: handler: js_handler.hello - runtime: nodejs14.x + runtime: nodejs20.x DotnetHello6: handler: dotnet_handler.hello runtime: dotnet6 diff --git a/scripts/generate_layers_json.sh b/scripts/generate_layers_json.sh index afcf204a..8199d7b5 100755 --- a/scripts/generate_layers_json.sh +++ b/scripts/generate_layers_json.sh @@ -13,8 +13,8 @@ set -e -LAYER_NAMES=("Datadog-Node14-x" "Datadog-Node16-x" "Datadog-Node18-x" "Datadog-Node20-x" "Datadog-Python37" "Datadog-Python38" "Datadog-Python38-ARM" "Datadog-Python39" "Datadog-Python39-ARM" "Datadog-Python310" "Datadog-Python310-ARM" "Datadog-Python311" "Datadog-Python311-ARM" "Datadog-Python312" "Datadog-Python312-ARM" "Datadog-Ruby3-2" "Datadog-Ruby3-2-ARM" "Datadog-Extension" "Datadog-Extension-ARM" "dd-trace-dotnet" "dd-trace-dotnet-ARM" "dd-trace-java") -JSON_LAYER_NAMES=("nodejs14.x" "nodejs16.x" "nodejs18.x" "nodejs20.x" "python3.7" "python3.8" "python3.8-arm" "python3.9" "python3.9-arm" "python3.10" "python3.10-arm" "python3.11" "python3.11-arm" "python3.12" "python3.12-arm" "ruby3.2" "ruby3.2-arm" "extension" "extension-arm" "dotnet" "dotnet-arm" "java") +LAYER_NAMES=("Datadog-Node16-x" "Datadog-Node18-x" "Datadog-Node20-x" "Datadog-Python37" "Datadog-Python38" "Datadog-Python38-ARM" "Datadog-Python39" "Datadog-Python39-ARM" "Datadog-Python310" "Datadog-Python310-ARM" "Datadog-Python311" "Datadog-Python311-ARM" "Datadog-Python312" "Datadog-Python312-ARM" "Datadog-Ruby3-2" "Datadog-Ruby3-2-ARM" "Datadog-Extension" "Datadog-Extension-ARM" "dd-trace-dotnet" "dd-trace-dotnet-ARM" "dd-trace-java") +JSON_LAYER_NAMES=("nodejs16.x" "nodejs18.x" "nodejs20.x" "python3.7" "python3.8" "python3.8-arm" "python3.9" "python3.9-arm" "python3.10" "python3.10-arm" "python3.11" "python3.11-arm" "python3.12" "python3.12-arm" "ruby3.2" "ruby3.2-arm" "extension" "extension-arm" "dotnet" "dotnet-arm" "java") AVAILABLE_REGIONS=$(aws ec2 describe-regions | jq -r '.[] | .[] | .RegionName') diff --git a/src/index.spec.ts b/src/index.spec.ts index 71db4ef8..883dfa8c 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -75,7 +75,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -97,7 +97,7 @@ describe("ServerlessPlugin", () => { expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:.*/), expect.stringMatching(/arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Extension:(.*)*/), ], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, provider: { @@ -122,7 +122,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -144,7 +144,7 @@ describe("ServerlessPlugin", () => { node1: { handler: "my-func.ev", layers: [expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:Datadog-Extension\:.*/)], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, provider: { @@ -169,7 +169,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -194,7 +194,7 @@ describe("ServerlessPlugin", () => { expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:.*/), expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:Datadog-Extension\:.*/), ], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, provider: { @@ -220,7 +220,7 @@ describe("ServerlessPlugin", () => { node1: { handler: "my-func.ev", layers: [], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -240,7 +240,7 @@ describe("ServerlessPlugin", () => { node1: { handler: "my-func.ev", layers: [expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:Datadog-Extension\:.*/)], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, provider: { @@ -264,7 +264,7 @@ describe("ServerlessPlugin", () => { node1: { handler: "my-func.ev", layers: [], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -285,7 +285,7 @@ describe("ServerlessPlugin", () => { node1: { handler: "my-func.ev", layers: [], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, provider: { @@ -311,7 +311,7 @@ describe("ServerlessPlugin", () => { node1: { handler: "my-func.ev", layers: [], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -334,7 +334,7 @@ describe("ServerlessPlugin", () => { expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:.*/), expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:Datadog-Extension\:.*/), ], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, provider: { @@ -564,7 +564,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -607,7 +607,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -647,7 +647,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -687,7 +687,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -727,7 +727,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -770,7 +770,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -809,7 +809,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -856,7 +856,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -894,7 +894,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -933,7 +933,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -979,7 +979,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -1387,7 +1387,7 @@ describe("ServerlessPlugin", () => { node1: { handler: "my-func.ev", layers: [], - runtime: "nodejs14.x", + runtime: "nodejs20.x", tags: { service: "test", }, @@ -1590,7 +1590,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { @@ -1626,7 +1626,7 @@ describe("ServerlessPlugin", () => { functions: { node1: { handler: "my-func.ev", - runtime: "nodejs14.x", + runtime: "nodejs20.x", }, }, custom: { diff --git a/src/layer.spec.ts b/src/layer.spec.ts index 4031e8ee..6ca1759e 100644 --- a/src/layer.spec.ts +++ b/src/layer.spec.ts @@ -42,7 +42,6 @@ describe("findHandlers", () => { it("finds all runtimes with matching layers", () => { const mockService = createMockService("us-east-1", { "go-function": { handler: "myfile.handler", runtime: "go1.10" }, - "node14-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, "node16-function": { handler: "myfile.handler", runtime: "nodejs16.x" }, "node18-function": { handler: "myfile.handler", runtime: "nodejs18.x" }, "node20-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, @@ -70,12 +69,6 @@ describe("findHandlers", () => { type: RuntimeType.UNSUPPORTED, runtime: "go1.10", }, - { - name: "node14-function", - handler: { handler: "myfile.handler", runtime: "nodejs14.x" }, - type: RuntimeType.NODE, - runtime: "nodejs14.x", - }, { name: "node16-function", handler: { handler: "myfile.handler", runtime: "nodejs16.x" }, @@ -185,55 +178,55 @@ describe("findHandlers", () => { describe("applyLambdaLibraryLayers", () => { it("adds a layer array if none are present at the function array or service.provider array", () => { const handler = { - handler: { runtime: "nodejs14.x" }, + handler: { runtime: "nodejs20.x" }, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { - regions: { "us-east-1": { "nodejs14.x": "node:2" } }, + regions: { "us-east-1": { "nodejs20.x": "node:2" } }, }; const mockService = createMockService("us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", layers: ["node:2"], }); }); it("appends to the layer array if already present", () => { const handler = { - handler: { runtime: "nodejs14.x", layers: ["node:1"] } as any, + handler: { runtime: "nodejs20.x", layers: ["node:1"] } as any, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { - regions: { "us-east-1": { "nodejs14.x": "node:2" } }, + regions: { "us-east-1": { "nodejs20.x": "node:2" } }, }; const mockService = createMockService("us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", layers: ["node:1", "node:2"], }); }); it("appends to the function layer array if the function layer array is empty and the provider array has items", () => { const handler = { - handler: { runtime: "nodejs14.x" } as any, + handler: { runtime: "nodejs20.x" } as any, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { - regions: { "us-east-1": { "nodejs14.x": "node:2" } }, + regions: { "us-east-1": { "nodejs20.x": "node:2" } }, }; const mockService = createMockService( "us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }, "x86_64", [], @@ -246,7 +239,7 @@ describe("applyLambdaLibraryLayers", () => { }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", layers: ["my-layer-1", "my-layer-2", "node:2"], }); expect(mockService.provider).toEqual({ @@ -258,17 +251,17 @@ describe("applyLambdaLibraryLayers", () => { it("appends to the function layer array if the function layer array and service.provider layer array each have items", () => { const handler = { - handler: { runtime: "nodejs14.x", layers: ["my-layer-1"] } as any, + handler: { runtime: "nodejs20.x", layers: ["my-layer-1"] } as any, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { - regions: { "us-east-1": { "nodejs14.x": "node:2" } }, + regions: { "us-east-1": { "nodejs20.x": "node:2" } }, }; const mockService = createMockService( "us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }, "x86_64", [], @@ -276,7 +269,7 @@ describe("applyLambdaLibraryLayers", () => { ); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", layers: ["my-layer-1", "node:2"], }); expect(mockService.provider).toEqual({ @@ -288,56 +281,56 @@ describe("applyLambdaLibraryLayers", () => { it("doesn't add duplicate layers", () => { const handler = { - handler: { runtime: "nodejs14.x", layers: ["node:1"] } as any, + handler: { runtime: "nodejs20.x", layers: ["node:1"] } as any, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { - regions: { "us-east-1": { "nodejs14.x": "node:1" } }, + regions: { "us-east-1": { "nodejs20.x": "node:1" } }, }; const mockService = createMockService("us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", layers: ["node:1"], }); }); it("only adds layer when region can be found", () => { const handler = { - handler: { runtime: "nodejs14.x" } as any, + handler: { runtime: "nodejs20.x" } as any, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { - regions: { "us-east-1": { "nodejs14.x": "node:1" } }, + regions: { "us-east-1": { "nodejs20.x": "node:1" } }, }; const mockService = createMockService("us-east-2", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", }); }); it("only adds layer when layer ARN can be found", () => { const handler = { - handler: { runtime: "nodejs14.x" } as any, + handler: { runtime: "nodejs20.x" } as any, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { regions: { "us-east-1": { "python3.9": "python:2" } }, }; const mockService = createMockService("us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", }); }); @@ -345,13 +338,13 @@ describe("applyLambdaLibraryLayers", () => { const handler = { handler: {} as any, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { regions: { "us-east-1": { "python3.9": "python:2" } }, }; const mockService = createMockService("us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({}); @@ -366,7 +359,7 @@ describe("applyLambdaLibraryLayers", () => { regions: { "us-east-1": { "python3.9": "python:2" } }, }; const mockService = createMockService("us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({}); @@ -374,23 +367,23 @@ describe("applyLambdaLibraryLayers", () => { it("detects when to use the GovCloud layers", () => { const handler = { - handler: { runtime: "nodejs14.x" }, + handler: { runtime: "nodejs20.x" }, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { regions: { "us-gov-east-1": { - "nodejs14.x": "arn:aws-us-gov:lambda:us-gov-east-1:002406178527:layer:Datadog-Node14-x:30", + "nodejs20.x": "arn:aws-us-gov:lambda:us-gov-east-1:002406178527:layer:Datadog-Node14-x:30", }, }, }; const mockService = createMockService("us-gov-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyLambdaLibraryLayers(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", layers: ["arn:aws-us-gov:lambda:us-gov-east-1:002406178527:layer:Datadog-Node14-x:30"], }); }); @@ -427,36 +420,36 @@ describe("applyLambdaLibraryLayers", () => { it("adds extension layer", () => { const handler = { - handler: { runtime: "nodejs14.x" }, + handler: { runtime: "nodejs20.x" }, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { regions: { "us-east-1": { extension: "extension:5" } }, }; const mockService = createMockService("us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }); applyExtensionLayer(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", + runtime: "nodejs20.x", layers: ["extension:5"], }); }); it("adds a Lambda library and Extension layer", () => { const handler = { - handler: { runtime: "nodejs14.x" }, + handler: { runtime: "nodejs20.x" }, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { - regions: { "us-east-1": { "nodejs14.x": "node:2", extension: "extension:5" } }, + regions: { "us-east-1": { "nodejs20.x": "node:2", extension: "extension:5" } }, }; const mockService = createMockService( "us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }, "x86_64", [], @@ -466,7 +459,7 @@ describe("applyLambdaLibraryLayers", () => { applyExtensionLayer(mockService, [handler], layers); expect(handler.handler).toEqual({ layers: ["my-layer-1", "my-layer-2", "node:2", "extension:5"], - runtime: "nodejs14.x", + runtime: "nodejs20.x", }); expect(mockService.provider).toEqual({ architecture: "x86_64", @@ -540,14 +533,14 @@ describe("applyLambdaLibraryLayers", () => { it("adds correct lambda layer given architecture in provider level for node", () => { const handler = { - handler: { runtime: "nodejs14.x" }, + handler: { runtime: "nodejs20.x" }, type: RuntimeType.NODE, - runtime: "nodejs14.x", + runtime: "nodejs20.x", } as FunctionInfo; const layers: LayerJSON = { regions: { "us-east-1": { - "nodejs14.x": "nodejs14.x", + "nodejs20.x": "nodejs20.x", extension: "extension:11", "extension-arm": "extension-arm:11", }, @@ -556,15 +549,15 @@ describe("applyLambdaLibraryLayers", () => { const mockService = createMockService( "us-east-1", { - "node-function": { handler: "myfile.handler", runtime: "nodejs14.x" }, + "node-function": { handler: "myfile.handler", runtime: "nodejs20.x" }, }, "arm64", ); applyLambdaLibraryLayers(mockService, [handler], layers); applyExtensionLayer(mockService, [handler], layers); expect(handler.handler).toEqual({ - runtime: "nodejs14.x", - layers: ["nodejs14.x", "extension-arm:11"], + runtime: "nodejs20.x", + layers: ["nodejs20.x", "extension-arm:11"], }); }); diff --git a/src/layer.ts b/src/layer.ts index bc2f873b..d88c2592 100644 --- a/src/layer.ts +++ b/src/layer.ts @@ -52,7 +52,6 @@ export interface LayerJSON { } export const runtimeLookup: { [key: string]: RuntimeType } = { - "nodejs14.x": RuntimeType.NODE, "nodejs16.x": RuntimeType.NODE, "nodejs18.x": RuntimeType.NODE, "nodejs20.x": RuntimeType.NODE, @@ -85,7 +84,6 @@ export const ARM_RUNTIME_KEYS: { [key: string]: string } = { extension: "extension-arm", dotnet: "dotnet-arm", // The same Node layers work for both x86 and ARM - "nodejs14.x": "nodejs14.x", "nodejs16.x": "nodejs16.x", "nodejs18.x": "nodejs18.x", "nodejs20.x": "nodejs20.x",