A simple, convenient way to invoke aws lambda functions with best practices.
- optional logDebug of input and output
- throw an error if response contains an error object
npm install --save simple-lambda-client
simple-lambda-client exports a function that lets you invoke lambda functions with best practices.
You can use this function directly if you want...
;;// ...do amazing things with result...
But you'll probably want to add some typedefs and name it for readability:
which makes using that a lot easier:
;// ...do amazing things with job
now you can just create a file of those typed lambda function methods, like above, and export each one, and let that be your client.
namespace (if you like)
optionally, you can build a full namespaced client:
// export the namespaced client;
and add extra context about "where" getJobByUuid is coming from
;;// ...do amazing things with job
if you're using this client from inside a lambda, ensure that this lambda has permission to invoke other lambdas
# serverless.ymliamRoleStatements:- Effect: AllowAction:- lambda:InvokeFunction- lambda:InvokeAsyncResource: '*' # TODO: constrain to a specific account, region, service, and stage