Skip to content

Testing AWS Lambda functions locally

One of the challenges a common developer finds when building serverless AWS Lambda functions is the test phase.

Lambda-Local package comes to the rescue, by simply installing the lambda-local package you’ll be able to flawlessly test your lambda functions.

Installing lambda-local

npm install -g lambda-local

Using lambda-local

lambda-local -f index.js -h handler -e test-event.json -E '{"envVar":"envValue"}'

-f: The file that holds our function
-h: The function we want to execute
-e: The event input we want to test
-E: The environment variables we want to emulate

Demo Sample code

You can check a quick demo code at my github public page.

Package documentation link: https://www.npmjs.com/package/lambda-local

Wrote this post as a quick reminder for myself, hope helps someone else.

Published inRandom Thoughts

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *