Nice writeup, digs into what is happening and why the environment is being setup which is more in-depth than I’d investigated playing with a (ruby) lambda recently.
When I come to fit these kinds of tests against our lambda (two network calls and mutates JSON in the middle), I’d lean on lambci/lambda images rather than build an RPC handler myself. Not only ensures you’re being called the exact same way as lambda invokes you, but saves having more of your own code to debug (:
Hello @caius and thanks for your comment.
Yeah, I think lambci is a good approach too. Definitely simpler in terms of setup.
Another approach that I started discussing after having written this post is to run the test in a real AWS environment and hosting the tester code somewhere in another lambda or in a docker container running on something like fargate. The advantage of that approach is that it could allow you to also test all your infrastructure as code configuration. The disadvantages are maybe cost and test running time, but I haven’t done any serious attempt at evaluating those yet.