Repository: motdotla/node-lambda (js)

Issue:
Update to nodejs 14.x
Hello,

AWS released nodejs 14.x as runtime for Lambda early february. Unfortunately when I updated my launch configuration for node-lambda to "AWS_RUNTIME=nodejs14.x", VS code debug console exits with code 254. 

Could you help me please?

Jean

Pull request description:
feat: support nodejs14.x runtime
fix #552 

Patch:
diff --git a/README.md b/README.md
index 15da0ab..315d191 100644
--- a/README.md
+++ b/README.md
@@ -81,7 +81,7 @@ AWS_MEMORY_SIZE            // (default: 128)
 AWS_TIMEOUT                // (default: 60)
 AWS_RUN_TIMEOUT            // (default: 3)
 AWS_DESCRIPTION            // (default: package.json.description or '')
-AWS_RUNTIME                // (default: 'nodejs12.x')
+AWS_RUNTIME                // (default: 'nodejs14.x')
 AWS_PUBLISH                // (default: false)
 AWS_FUNCTION_VERSION       // (default: '')
 AWS_VPC_SUBNETS            // (default: '')
@@ -119,7 +119,7 @@ Options:
   -h, --help                            output usage information
   -H, --handler [index.handler]         Lambda Handler {index.handler}
   -j, --eventFile [event.json]          Event JSON File
-  -u, --runtime [nodejs12.x]            Lambda Runtime
+  -u, --runtime [nodejs14.x]            Lambda Runtime
   -t, --timeout [3]                     Lambda Timeout
   -f, --configFile []                   Path to file holding secret environment variables (e.g. "deploy.env")
   -x, --contextFile [context.json]      Context JSON File
@@ -180,7 +180,7 @@ Options:
   -m, --memorySize [128]              Lambda Memory Size
   -t, --timeout [3]                   Lambda Timeout
   -d, --description [missing]         Lambda Description
-  -u, --runtime [nodejs12.x]          Lambda Runtime
+  -u, --runtime [nodejs14.x]          Lambda Runtime
   -p, --publish [false]               Lambda Publish
   -L, --lambdaVersion []              Lambda Function Version
   -b, --vpcSubnets []                 Lambda Function VPC Subnet IDs (comma delimited)
@@ -217,7 +217,7 @@ AWS Lambda will let you set environment variables for your function. Use the sam
 
 ## Node.js Runtime Configuration
 
-AWS Lambda now supports Node.js 12 and Node.js 10. Please also check the [Programming Model (Node.js)](http://docs.aws.amazon.com/lambda/latest/dg/programming-model.html) page.
+AWS Lambda now supports Node.js14, Node.js 12 and Node.js 10. Please also check the [Building Lambda functions with Node.js](https://docs.aws.amazon.com/lambda/latest/dg/lambda-nodejs.html) page.
 
 ## To deploy a container image to Lambda
 
diff --git a/bin/node-lambda b/bin/node-lambda
index 9a9446d..cac6632 100755
--- a/bin/node-lambda
+++ b/bin/node-lambda
@@ -28,7 +28,7 @@ const AWS_MEMORY_SIZE = process.env.AWS_MEMORY_SIZE || 128
 const AWS_TIMEOUT = process.env.AWS_TIMEOUT || 60
 const AWS_RUN_TIMEOUT = process.env.AWS_RUN_TIMEOUT || 3
 const AWS_DESCRIPTION = process.env.AWS_DESCRIPTION || packageJson.description || ''
-const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs12.x'
+const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs14.x'
 const AWS_PUBLISH = process.env.AWS_PUBLISH || false
 const AWS_FUNCTION_VERSION = process.env.AWS_FUNCTION_VERSION || ''
 const AWS_VPC_SUBNETS = process.env.AWS_VPC_SUBNETS || ''
diff --git a/lib/.env.example b/lib/.env.example
index 1990e40..ba91794 100644
--- a/lib/.env.example
+++ b/lib/.env.example
@@ -10,7 +10,7 @@ AWS_HANDLER=index.handler
 AWS_MEMORY_SIZE=128
 AWS_TIMEOUT=3
 AWS_DESCRIPTION=
-AWS_RUNTIME=nodejs12.x
+AWS_RUNTIME=nodejs14.x
 AWS_VPC_SUBNETS=
 AWS_VPC_SECURITY_GROUPS=
 AWS_TRACING_CONFIG=
diff --git a/lib/main.js b/lib/main.js
index 0bd723c..5437379 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -51,7 +51,7 @@ event_sources.json and ${program.eventFile} files as needed.`)
   }
 
   run (program) {
-    if (!['nodejs10.x', 'nodejs12.x'].includes(program.runtime)) {
+    if (!['nodejs10.x', 'nodejs12.x', 'nodejs14.x'].includes(program.runtime)) {
       console.error(`Runtime [${program.runtime}] is not supported.`)
       process.exit(254)
     }


Test patch:
diff --git a/test/main.js b/test/main.js
index 0a86f59..65060e3 100644
--- a/test/main.js
+++ b/test/main.js
@@ -20,7 +20,7 @@ const originalProgram = {
   memorySize: 128,
   timeout: 3,
   description: '',
-  runtime: 'nodejs12.x',
+  runtime: 'nodejs14.x',
   deadLetterConfigTargetArn: '',
   tracingConfig: '',
   Layers: '',
diff --git a/test/node-lambda.js b/test/node-lambda.js
index ec610a8..3f94b2d 100644
--- a/test/node-lambda.js
+++ b/test/node-lambda.js
@@ -156,7 +156,7 @@ describe('bin/node-lambda', () => {
         process.env.AWS_RUNTIME = 'test'
       })
       after(() => {
-        process.env.AWS_RUNTIME = 'nodejs12.x'
+        process.env.AWS_RUNTIME = 'nodejs14.x'
       })
 
       it('`node-lambda run` exitCode is `254` (callback(null))', (done) => {