How to test aws lambda functions locally
It doesn't look like there's way to do this right now, but version 1.4.0 is about to be released and, among other things, it should include a new command "jaws serve" which should address your problem.
Here's the PR: https://github.com/jaws-framework/JAWS/pull/269
UPDATE: you can now use the new serverless-serve plugin for this.
UPDATE 2: serverless-serve hasn't been updated in a while, it looks like serverless-offline is a much better option now to emulate Lambda functions.
You can now use lambda-local.
Install it like this:
sudo -H npm install -g lambda-local
Add your parameters as a JSON object to a file, in this example event.json
, and call the index.js
file like this:
lambda-local -l index.js -h handler -e event.json
I'm not sure if this question is still relevant or not, but I'm using DEEP Framework to test the code locally and/or deploy it on AWS Lambda. Check this out:
npm install deepify -gdeepify run-lambda --help run-lambda@1.6.8 - Run Lambda function locally Usage example: deepify run-lambda path/to/the/lambda -e='{"Name":"John Doe"}' Arguments: path: The path to the Lambda (directory of handler itself) Options: --event|-e: JSON string used as the Lambda payload --skip-frontend-build|-f: Skip picking up _build path from the microservices Frontend --db-server|-l: Local DynamoDB server implementation (ex. LocalDynamo, Dynalite) --version|-v: Prints command version --help|-h: Prints command help
Disclosure: I am one of the contributors to this framework