Lurker News
Hey HN,

I've been using AWS lambda a bit recently, mostly as a way to glue together various bits and pieces.
Maybe I'm doing this wrong but does anyone else find the experience to be really frustrating?
I can unit test bits of the code just fine, but at some point I always end up stuck in a slow feedback loop where I deploy the code, do some manual invoking, go and dig through the logs in CloudWatch, add another print statement in my lambda... and so on.
What I want is to run the lambdas locally, ideally more than one, and then exercise them with streams of test events (perhaps captured from a real environment). It would be quite cool if I could define BDD style tests around them too.
Anyone have any suggestions or share my frustrations?
I have heard localstack is quite good although I haven't given it a go yet. Would that work for me? I did try SAM but I was a bit underwhelmed and I don't want to use a separate IaC tool for these.
Alternatively, do other FaaS providers solve this problem?
Thanks for any help.

Comments (278) 96 threads

Show all comments

Showing thread 31 of 96

redhale2 replies#
I completely agree, especially having just come from working with Azure Functions. This likely also applies to other runtimes, but definitely for dotnet, you can run all Functions in a solution locally via the default F5 debugging feature in Visual Studio. Stellar developer experience.
flyinglizard#
It’s astonishing how entrenched is the HN type in AWS that this no one said it before.

P.S you can even attach the VS debugger to the live, deployed remote function and get full debugging (although quite slow). Don’t forget to deploy with the Debug (rather than Release) profile if you wanna do that. Breakpoints and all!

Arnavion#
And even if you're on Linux, there is a VSCode addon that is equivalent [1]. And even if you can't / don't want to use VSCode or the addon, you can download and run the Functions host yourself via the `func` tool [2]. (The latter is what I do for my own Functions.)

One caveat with these options is that the Function won't get a Managed Service Identity since it's running locally, so if you have code that relies on an MSI you'll have to create a Service Principal and make your code support SPs too.
Apart from that, the beahvior of the Function running locally or in the cloud should be identical.
[1]: https://marketplace.visualstudio.com/items?itemName=ms-azure...
[2]: https://github.com/Azure/azure-functions-core-tools/releases Azure.Functions.Cli.linux-*