nice-invoke-lambda
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

nice-invoke-lambda

A nice way to invoke AWS Lambda functions from Lambda functions

invoke(lambdaFunction, lambdaEvent)

Returns a promise that will invokes a Lambda function synchronously, automatically serializing and deserializing the event and response payloads. Resolves to the successful function response, or rejects if there is a failure at any level, including when an error string is returned by the Lambda function handler callback. If a returned error string is JSON, it will also be automatically deserialized.

lambdaFunction is a string of the function name or ARN, and either style may be qualified with a version or alias.

lambdaEvent is the event object intended for the Lambda handler to receive.

Example:

const invoke = require('nice-invoke-lambda').invoke;

invoke('AddNumbers', { a: 1, b: 3 })
  .then(result => {
    console.log(`1 + 3 = ${result}`);
  })
  .catch(error => {
    console.error(error);
  });

Package Sidebar

Install

npm i nice-invoke-lambda

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.51 kB

Total Files

6

Last publish

Collaborators

  • lafiosca