MerLoc makes it possible to - test your function locally without deploy to the AWS Lambda environment (so no wait for build, package and deploy) - debug your function by putting breakpoints from your IDE - hot-reload updated function on your local automatically to apply changes automatically (so again no wait for build, package and deploy) - run the individual function locally while it is still part of flow shown above and use real requests from the AWS Lambda environment
Edit: Here's some more conversations I found on the topic of the terrible workflow for cloud dev if anyone is interested https://news.ycombinator.com/item?id=26855037
Unfortunately we have a full Javascript stack at my company, but I'll keep an eye on this in case anybody adds more dev environments!
I’m not an MS fanboy by any stretch but VS Code, Azure Functions, and even local storage emulation with Azurite is pretty slick.
First time I played with it my background was very far from anything in this space (literally first time I used node) and I had a completely locally developed toy function with storage up and running in maybe 30 minutes. Then in a few clicks it was deployed and running in Azure.
All in less time than it took for me to wander through the AWS docs and console to even figure out which product to use.
But honestly, all a Lambda is a script with a function that takes two parameters - an event and a context. You can scaffold testing and development just like you would a controller action in an MVC framework - use a test harness that calls the method with the correct JSON payload and usually a null event context.
LocalStack is great tool but the difference here is that MerLoc runs your function in local against real cloud services with the same credentials of your real AWS Lambda function. So there is no AWS service simulation, mocking or local implementation here.
We also have developed another debugging tool to debug AWS Lambda function on remote AWS Lambda environment from your local IDE: https://www.serverlessdebugger.com/
It doesn't support hot-reload but very useful for debugging functions.
I get that if you’re trying to access some AWS service, this could be helpful but in that case I thought the general consensus is basically mock things out.
For serious software you want a proper local/unit test setup anyway. Using this in your dev cycles is just the natural next step. Instead of waiting for the cdk/cfn deploy to finish, which really is way too slow, you just execute 'jest' or whatever test framework you have.
Sure, figuring out how to mock everything takes some upfront time, but it pays off in the long run.
For deployment I have a generic "wrapper" that makes it lambda-compatible by converting a webEvent -> Json and my outputJSON -> web response event.
https://docs.aws.amazon.com/serverless-application-model/lat...
The difference is that MerLoc runs functions on your local as a part of AWS cloud infa. This means that function is triggered from real events, runs againts real AWS services and again response is returned to real AWS services.
Does it only work with HTTP Lambdas / manual invocations, or does it also play well with others, like SQS subscriptions? I think that's the biggest pain point for local Lambda development with the AWS-provided tooling for me right now, as detailed in a blog post I wrote a while ago[0].
All the official tooling only lets you do HTTP calls and manual invocations for locally running Lambdas, which means you can't really test architectures comprised of multiple Lambdas, or where Lambdas are just a part of the whole setup.
Yes it is only for Java runtime but Node.js runtime is also in our near-term roadmap. If you are looking for Node.js runtime, could you please upvote issue here: https://github.com/thundra-io/merloc/issues/1 or create a new one if you have any other request.
It works for *all* Lambda invocation triggers: Manual, HTTP, SQS, SNS, Kinesis etc ...
There is no limitation for debugging. When you changed any source code, it is compiled and then related functions are reloaded on your local automatically. So when you apply a change or fix for your function, you can check whether it works or not without deploy to AWS Lambda environment. So it increases serverless application development productivity by helping you developing and debugging faster.
There any many people looking for Node support as it is the most common serverless runtime.
Could you please thumbs-up its feature request here: https://github.com/thundra-io/merloc/issues/1
https://aws.amazon.com/intellij/
https://aws.amazon.com/pycharm/
https://aws.amazon.com/visualstudiocode/
I have used the Pycharm in Python Lambda development and I was able to set a breakpoint in my IDE and hit it and see the status of all my variables.
Is MerLoc an alternative to that?
But MerLoc runs it on your local as a part of AWS cloud infr This means that function is triggered from real events, runs againts real AWS services and again response is returned to real AWS services
Current version of MerLoc is similar to SST except some minor details.
The biggest difference so far is that you can use MerLoc with any deployment tool like AWS CDK, AWS CloudFormation, AWS SAM, Serverless Framework, SST, Terraform, etc ...
And we are also working on an improvement which will let you use the same network with the remote function on your local.
This looks awesome, congrats Serkan and team! Indeed, looks similar to SST, with the extensions you've mentioned.
I can see this becoming very useful if you want the local debuggability of Lambdas in your IDE, with code running remotely. (i.e., not leveraging locally emulated services)
Looking forward to giving it a whirl and see how it can integrate with (or even run against) LocalStack..! :) Keep up the great work!
However i cant help but notice how large corps, such as amazon, build products on top of freely available software, intentionally leave gaps in their offering (aws local dev is horrible, amazon doesnt provide a local env so we wont build an alternative - but is happy to use ours) and then the community steps in and fills in the gaps. I yet have to understand how they get away with such things.
Hopefully amazon will have the decency to sponsor such projects.