Sign inSign up

freshwebio/lightning-nodejs12x-runtime

By freshwebio

•Updated about 6 years ago

Lightning nodejs local lambda function runtime

Image
0

310

freshwebio/lightning-nodejs12x-runtime repository overview

⁠lightning-nodejs12.x

The lightning local lambda runtime environment for nodejs12.x.

This provides a single nodeJS process with a http interface that manages all lambda functions in a single environment.

The caller needs to mount ALL the volumes for the CodeURI for a lambda function in a cloudformation template into the docker container running this environment.

Each lambda function is run in a separate process in order to keep an isolated set of environment variables per function. These are lightweight unix processes and not docker containers!

⁠Using the docker image

docker run -p 5025:5025 freshwebio/lightning-nodejs12x-runtime:latest

⁠API

Base URL: https://localhost:5025⁠ (as an example)

⁠Register lambda function [POST /register]
⁠Request Body
{
  "handler": "{string} - REQUIRED (e.g. lambda.handler)",
  "codeUri": "{string} - REQUIRED (e.g. ../../build/my_function)",
  "functionName": "{string} - REQUIRED (e.g. MyFunction)"
}

The caller is responsible for making sure it mounts the code into the container for lambda functions.

⁠Response Body
{ "success": true }
⁠Invoke lambda function [POST /invoke/:functionName]
⁠Request Body
{
  "payload": "{any} - REQUIRED - Payload can be anything but a value must be provided!",
  "timeout": "{number} - OPTIONAL, DEFAULT = 3 - Timeout in seconds",
  "environment": "{string} - OPTIONAL - Stringified object of environment variables",
  "callerContext": "{string} - OPTIONAL - A caller context (e.g. /my/api/endpoint)",
  "requestId": "{string} - OPTIONAL"
}
⁠Response Body

The response body returned by the invoked lambda function or in case of environment/uncaught exceptions:

// Status 500
{
  "message": "Something went wrong",
  "stack": "Stack trace here if possible"
}

Tag summary

Content type

Image

Digest

Size

43.9 MB

Last updated

about 6 years ago

docker pull freshwebio/lightning-nodejs12x-runtime