Serverless Plugin Node Shim

homepage icon https://github.com/jzimmek/serverless-plugin-node-shim
Follow @jzimmek

Tracked

NPM Downloads Last Month
9
Issues
0
Stars
0
Forks
0
Watchers
0
Watch Star Fork Issue Download License NPM Build Status Coverage Status Contributors

Repo README Contents:

serverless-plugin-node-shim

Serverless plugin to run your functions in nodejs version (8 LTS, 9+) on aws lambda

Highlights

Install & Configure

$ npm install serverless-plugin-node-shim --save-dev

Add the plugin to your serverless.yml file:

plugins:
  - serverless-plugin-node-shim

Download and extract a x64 linux binary from https://nodejs.org/en/download/ into your project root

$ curl 'https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz' | tar xf -

Let the plugin know the path to your nodejs binary (relative to project root)

custom:
  nodeShim:
    execPath: node-v8.9.4-linux-x64/bin/node

Examples

NodeJS 8 LTS

git clone https://github.com/jzimmek/serverless-plugin-node-shim
cd serverless-plugin-node-shim
npm install
cd examples/node-v8-lts
npm install
npm run deploy
npm run invoke

NodeJS 9

git clone https://github.com/jzimmek/serverless-plugin-node-shim
cd serverless-plugin-node-shim
npm install
cd examples/node-v9
npm install
npm run deploy
npm run invoke

serverless-webpack + NodeJS 9

git clone https://github.com/jzimmek/serverless-plugin-node-shim
cd serverless-plugin-node-shim
npm install
cd examples/with-webpack
npm install
npm run deploy
npm run invoke

Credits

This plugin is heavily inspired by the way apex is implemented. Reading the source code of serverless-coffeescript was very helpful.