Repository: motdotla/node-lambda
Pull request #510 (2019-12-05 00:44:23)

Add nodejs12.x to runtime
* https://aws.amazon.com/jp/about-aws/whats-new/2019/11/aws-lambda-supports-node-js-12/
* https://docs.aws.amazon.com/us_en/lambda/latest/dg/lambda-runtimes.html


Patch:
diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index 43cfff5..b83e7b3 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -1,6 +1,6 @@
 name: Node CI
 
-on: [push]
+on: [push, pull_request]
 
 jobs:
   test:
@@ -12,10 +12,11 @@ jobs:
         os: [ubuntu-latest, windows-latest, macos-latest]
     steps:
     - uses: actions/checkout@master
-    - uses: actions/setup-node@v1
+    - uses: actions/setup-node@master
       with:
         node-version: ${{ matrix.node-version }}
-    - name: npm install, and test
-      run: |
-        npm install
-        npm test
+    - run: npm i -g npm
+    - run: node -v
+    - run: npm -v
+    - run: npm ci
+    - run: npm test
diff --git a/README.md b/README.md
index 5f7d871..f393bf6 100644
--- a/README.md
+++ b/README.md
@@ -80,7 +80,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: 'nodejs10.x')
+AWS_RUNTIME                // (default: 'nodejs12.x')
 AWS_PUBLISH                // (default: false)
 AWS_FUNCTION_VERSION       // (default: '')
 AWS_VPC_SUBNETS            // (default: '')
@@ -116,7 +116,7 @@ Options:
   -h, --help                            output usage information
   -H, --handler [index.handler]         Lambda Handler {index.handler}
   -j, --eventFile [event.json]          Event JSON File
-  -u, --runtime [nodejs10.x]            Lambda Runtime
+  -u, --runtime [nodejs12.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
@@ -176,7 +176,7 @@ Options:
   -m, --memorySize [128]              Lambda Memory Size
   -t, --timeout [3]                   Lambda Timeout
   -d, --description [missing]         Lambda Description
-  -u, --runtime [nodejs10.x]          Lambda Runtime
+  -u, --runtime [nodejs12.x]          Lambda Runtime
   -p, --publish [false]               Lambda Publish
   -L, --lambdaVersion []              Lambda Function Version
   -b, --vpcSubnets []                 Lambda Function VPC Subnets
@@ -210,7 +210,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 10, Node.js 8.10 and Node.js 6.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.js 12, Node.js 10 and Node.js 8.10. Please also check the [Programming Model (Node.js)](http://docs.aws.amazon.com/lambda/latest/dg/programming-model.html) page.
 
 ## Post install script
 When running `node-lambda deploy` if you need to do some action after `npm install --production` and before deploying to AWS Lambda (e.g. replace some modules with precompiled ones or download some libraries, replace some config file depending on environment) you can create `post_install.sh` script. If the file exists the script will be executed (and output shown after execution) if not it is skipped. Environment string is passed to script as first parameter so you can use it if needed. Make sure that the script is executable.
diff --git a/bin/node-lambda b/bin/node-lambda
index d1c1c4e..a963ef2 100755
--- a/bin/node-lambda
+++ b/bin/node-lambda
@@ -29,7 +29,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 || 'nodejs10.x'
+const AWS_RUNTIME = process.env.AWS_RUNTIME || 'nodejs12.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 7f08108..1990e40 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=nodejs10.x
+AWS_RUNTIME=nodejs12.x
 AWS_VPC_SUBNETS=
 AWS_VPC_SECURITY_GROUPS=
 AWS_TRACING_CONFIG=
diff --git a/lib/main.js b/lib/main.js
index 6c48dfc..e83e52a 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 (!['nodejs8.10', 'nodejs10.x'].includes(program.runtime)) {
+    if (!['nodejs8.10', 'nodejs10.x', 'nodejs12.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 c01ff3f..71f8a05 100644
--- a/test/main.js
+++ b/test/main.js
@@ -20,7 +20,7 @@ const originalProgram = {
   memorySize: 128,
   timeout: 3,
   description: '',
-  runtime: 'nodejs10.x',
+  runtime: 'nodejs12.x',
   deadLetterConfigTargetArn: '',
   tracingConfig: '',
   Layers: '',
diff --git a/test/node-lambda.js b/test/node-lambda.js
index 27f9461..ba27735 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 = 'nodejs10.x'
+        process.env.AWS_RUNTIME = 'nodejs12.x'
       })
 
       it('`node-lambda run` exitCode is `254` (callback(null))', (done) => {