0.0.2 • Published 7 years ago
lambdacadabra v0.0.2
lambdacadabra
This is a simple library that transforms any function into an AWS Lambda handler.
Installation
$ npm install --save lambdacadabra
First, define the function that will be turned into a handler. That function will be called with the lambda's payload and context:
const doSomeWork = (payload, context) => 'Hello, World!';
Then use lambdacadabra
to turn that function into a handler:
module.exports.handler = lambdacadabra(doSomeWork);
The return value of the function will be passed as the second parameter to the AWS Lambda's callback function. If an error is thrown while executing the function, it will be caught and passed as the first parameter to that callback.
lambdacadabra
will also log errors, including the offending payload. To take advantage of that
feature, make sure your lambda's execution role has permissions to write to CloudWatch Logs.