Open andrhamm opened 7 years ago
@andrhamm I think you're looking for something like https://github.com/localstack/localstack
Localstack looks interesting but extremely heavyweight to me.
I’ve been meaning to add a “deploy passthru lambda” capability to serverless-plugin-bespoken which might help with your use case. The idea being to deploy a “passthru” lambda that simply invokes the bespoken proxy with the same arguments as the aws lambda received. I think it will work for a variety of use cases pretty well. My motivation is faster development cycles and the ability to use a debugger ...
Hey @andrhamm
This pull request might be useful for you?
https://github.com/bespoken/serverless-plugin-bespoken/pull/8
It adds an option to the serverless deploy command that replaces the lambdas that would be deployed by your serverless config with passthru's that invoke the bespoken proxy. It works in conjunction with the serverless proxy
command.
So you would run: serverless deploy --stage someStage --inject-passthru
To deploy the passthrus and then
serverless proxy --stage someStage
to fire up a local server for handling the proxied requests on your machine. Means the 'event' arguments you receive aren't simulated but rather coming directly from whatever event source caused your lambda to be invoked on aws side.
The event argument received by my function when using the proxy plugin is not very similar to true Lambda/APIG events. It seems that currently this plugin is only useful for purely JSON API requests. It would be great if the event payload could more closely simulate a true event. It would also be handy if the logging was more specific about what "Payload" is (request vs response... and it is really only referring to the body for requests).
Examples:
Example func:
Logs for a proxy event:
Real event (first arg of lambda func):