Debugging AWS Lambda Functions

Amazon Web Services (AWS) is without a doubt a developer’s tool that moves applications a step closer to complete elimination of bugs and especially in applications that are deployed from a cloud. If we focus on one AWS service, the AWS (Amazon) Lambda, we walk into a space that has been marred with complaints from developers. The major complaint is that AWS Lambda is unable to simultaneously run and debug functions locally. For practicality sake, let us focus on Node.js in finding answers to this challenge. Before we think of solutions to this challenge, however, let us think of the AWS Lambda Function.

Why is it so cool?

The creators AWS claim that using Lambda allows one the freedom to work through a project without thinking about the infrastructure. Developers are also promised seamless launching of applications into the cloud where what they have created gets to integrate with Amazon services. Other benefits that may influence a developer’s decision to use AWS Lambda over other functions are low costs of in-built resources and scalability. Using this function is also quite easy because the work of a developer is only to write code and link it to events, leaving updating functions to Amazons. The question about the Lambda function being able to process requests in a fraction of a second is not in doubt here.

AWS lambda functions debugging options;

  1. The AWS Cloud Watch is a default method and users are inclined to using it because it is free of charge. If you are working on a tight time schedule, this method will through you a major setback because it is rather slow. The average amount of time spent on it is 40 minutes.
  1. Deployed lambda functions logging which can be implemented in conjunction with other AWS services like Kinesis. This is relatively faster and most developers will appreciate the faster processing encountered with using it. On the flipside, the need for developers to create some tools manually could eat up into valuable time especially for inexperienced developers.
  2. Offline debugging is the third option and is quite useful in debugging standard development processes. The main advantage of offline debugging is that it allows the developer to work locally on their code.
  3. The invoke local command is an overlooked feature of the AWS Lambda function that works by causing created code to run while simultaneously emulating the familiar AWS Lambda environment. While it does not work for any language of code, those that work with Python or Node.js will find it to be quite a resource.