Skip to content
A custom runtime for AWS Lambda to execute functions in Node.js v10.x or v12.x
Shell C JavaScript Dockerfile
Branch: master
Clone or download
Latest commit 47abb51 Nov 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
img Initial commit Nov 29, 2018
v10.x Update to 10.17.0 Oct 22, 2019
v12.x Update to 12.13.1 Nov 19, 2019
.gitignore Remove v11.x – no need for it now that v12 is here Apr 23, 2019
LICENSE Initial commit Nov 29, 2018 Update to 12.13.1 Nov 19, 2019

Node.js 10.x and 12.x for AWS Lambda

A custom runtime for AWS Lambda to execute functions in Node.js 10.x or 12.x

NB: Recent changes to this runtime regarding legacy support

Starting from nodejs10 layer version 13 and nodejs12 layer version 4, this runtime is compatible with the legacy AWS runtimes. This means if you use the legacy callback syntax, you may need to set context.callbackWaitsForEmptyEventLoop = false if your Lambda is timing out. If you use async functions, return a Promise, or use context.done(), you shouldn't need to change anything.

Getting Started

Save as index.js:

exports.handler = async(event, context) => {
  console.log(`Hi from Node.js ${process.version} on Lambda!`)
  console.log(`There is ${context.getRemainingTimeInMillis()}ms remaining`)
  return event

Then bundle up into a zipfile – this is your function bundle:

zip -yr index.js  # add node_modules too if you have any

Create a new Lambda function and choose the custom runtime option.

Create lambda

Select your as the "Function code" and make the handler "index.handler".

Function code

Then click on Layers and choose "Add a layer", and "Provide a layer version ARN" and enter the following ARN:


Or use this link and pick your function from the "Function name" auto-suggest.

Add a layer

Then save your lambda and test it with a test event!

Test event output

Current Version ARNs

Node.js version ARN
10.17.0 arn:aws:lambda:<region>:553035198032:layer:nodejs10:18
12.13.1 arn:aws:lambda:<region>:553035198032:layer:nodejs12:20

Previous Version ARNs

Node.js version ARN
12.13.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:19
10.16.3 arn:aws:lambda:<region>:553035198032:layer:nodejs10:17
12.12.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:18
12.11.1 arn:aws:lambda:<region>:553035198032:layer:nodejs12:17
12.11.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:16
12.10.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:15
12.9.1 arn:aws:lambda:<region>:553035198032:layer:nodejs12:14
12.9.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:13
12.8.1 arn:aws:lambda:<region>:553035198032:layer:nodejs12:12
10.16.2 arn:aws:lambda:<region>:553035198032:layer:nodejs10:16
12.8.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:11
12.7.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:10
10.16.1 arn:aws:lambda:<region>:553035198032:layer:nodejs10:15
10.16.0 arn:aws:lambda:<region>:553035198032:layer:nodejs10:14
12.6.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:9
12.5.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:8
12.4.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:7
12.3.1 arn:aws:lambda:<region>:553035198032:layer:nodejs12:6
10.15.3 arn:aws:lambda:<region>:553035198032:layer:nodejs10:13
12.3.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:5
12.2.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:4
12.1.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:2
12.0.0 arn:aws:lambda:<region>:553035198032:layer:nodejs12:1
11.14.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:17
11.13.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:16
11.12.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:13
11.11.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:11
11.10.1 arn:aws:lambda:<region>:553035198032:layer:nodejs11:10
10.15.2 arn:aws:lambda:<region>:553035198032:layer:nodejs10:7
10.15.1 arn:aws:lambda:<region>:553035198032:layer:nodejs10:6
11.10.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:9
11.9.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:8
11.8.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:7
10.15.0 arn:aws:lambda:<region>:553035198032:layer:nodejs10:5
11.7.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:6
11.6.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:5
10.14.2 arn:aws:lambda:<region>:553035198032:layer:nodejs10:3
11.4.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:4
10.14.1 arn:aws:lambda:<region>:553035198032:layer:nodejs10:1
11.3.0 arn:aws:lambda:<region>:553035198032:layer:nodejs11:1

Things to be aware of

  • This is a no-batteries-included runtime – you'll need to zip up any node_modules dependencies, including aws-sdk with your lambda function
  • It does not monkeypatch console.log, console.error, etc functions to add extra timestamps and request IDs to each line you log as the official runtimes do. I believe this leads to fewer surprises and cleaner logs that are easier to parse by various tools – but if you're relying on this behaviour you'll need to add these fields yourself.
  • Cold start overhead of ~240ms for Node.js 10.x and ~260ms for 12.x – this is due to Node.js' increasingly slow startup time, but they're working on it!
You can’t perform that action at this time.