Testing Node AWS Lambda handler function locally

Add a script to your package.json file

"scripts": {
    "local": "node -e \"console.log(require('./index').handler({}));\""
}

where index is the name of your js file with the code you want to execute

You can execute this script by running

npm run local
Matt Busche's Picture

About Matt Busche

Matt is a developer at Nationwide Insurance and Freelance Consultant. If this article helped you, please consider buying me a book.

Des Moines, IA https://www.matthewbusche.com