Welp, we're going to look at some nodejs code for and aws lambda function here, and specifically the code will be invoking a different lambda function. Although there are a few ways to do this, I really wanted to find a way of chaining lambdas such that they don't have to wait for the one one they just called to finish. It's a bit confusing, but maybe with some example you'll understand what I mean. Well then let's dive right in!
Once upon a time I was the serverless guy at a startup company building lambda functions. My function went into production at 128mb of memory and a timeout of 3 seconds. Because of game had "live races" we would see big spikes in traffic at certain times of the day, and unfortunately I would also see big spikes in the number of errors in the CloudWatch metrics charts... My boss even opened the website during the high volume event and noticed requests to the lambda returning 400 error. In the cloudwatch logs I could norrow down the logs to just the high volume time and see many timeout errors happening during this period. Needless to say, this is not a good look, and you don't want it to happen to you (especially you, future Jim)!
Regardless of what language you're coding in, you need to use some type of version control for any serious project. Personally, I like using the command line to push my code to a git repository (and if you're going to try to argue that your git GUI client is better- please, the command line is faster to use, lighter on your machine, and just gives you the most control). Although I love using git from the shell, I found myself repeatedly doing the same three commands over and over:
Originally, I was just looking for a way to at least combine the add and commit steps into just one command. I learned that you could add a "-a" flag onto the end of commit, but that's not quite the same as add -A. I even started this reddit thread about the subject, and it was from these answers that "git gg" was born.
This is something that tripped me up a little bit when I was recently playing around with DynamoDB. I was very confused because in the callback function the data argument was just coming back as an empty object. "Surely that can't be right", I thought, but indeed it was right!
Well guys, I learned a cool new thing today! Did you know about the "it.only" syntax in mocha? Can you believe I just discovered it today?! Yep, my life has forever changed for the better now that I'm aware of in.only, and since you're reading this post right now I hope it will change yours too!
The posts on this site are written and maintained by Jim Lynch. About Jim...