DEV Community

Cover image for Serverless Developer Experience is Finally Great with Lambda Live Debugger
Marko - ServerlessLife.com
Marko - ServerlessLife.com

Posted on • Originally published at serverlesslife.com

Serverless Developer Experience is Finally Great with Lambda Live Debugger

Lambda Live Debugger allows you to remotely debug AWS Lambda functions, eliminating the need for time-consuming redeployment.

Lambda Live Debugger is an open-source tool that redefines serverless development by simplifying the debugging process for AWS Lambda functions. It allows developers to debug deployed Lambda functions locally, eliminating the need for redeployment and streamlining the entire workflow. With support for JavaScript, TypeScript, and numerous frameworks, Lambda Live Debugger addresses the challenges of the traditional serverless development cycle, enabling developers to bypass the tedious process of writing, deploying, and testing code, all while maintaining the same IAM permissions as if the code were running in the cloud.

How It Works

Lambda Live Debugger connects your deployed Lambda functions to your local machine through AWS IoT. It intercepts requests, routes them to your local environment for debugging, and sends responses back to the deployed Lambda. This means you can inspect and interact with your Lambda function in real-time while it remains fully integrated with its cloud environment.

Architecture

In case of code changes, the tool automatically reloads the updated code without the need to redeploy or restart the debugger. TypeScript functions are automatically transpiled into JavaScript and run via Node Worker Threads.

The Easiest Way to Configure: The Wizard

One of the most convenient features of Lambda Live Debugger is its easy configuration process through the interactive wizard. Running the wizard configures key parameters such as AWS profile, region, and more with a single command:

lld -w
Enter fullscreen mode Exit fullscreen mode

The wizard automatically generates a configuration file (lldebugger.config.ts) and even sets up your debugging environment in VSCode with the necessary launch configurations in .vscode/launch.json. This ensures that you can jump straight into debugging without manual configuration steps.

You can now press F5 in VSCode to start debugging, set breakpoints, and inspect variables.

Debugging

Fast Switching Between Development Modes

With Lambda Live Debugger, switching between active debugging and regular execution is incredibly fast. Simply run the following command to remove the debugger:

lld -r
Enter fullscreen mode Exit fullscreen mode

This detaches the debugger from your Lambda functions, allowing you to quickly resume normal operation. Turning the debugging mode back on is just as fast. In comparison, alternative solutions often require a full redeployment, wasting valuable time and resources.

Focus on Specific Lambdas

Another powerful feature is the ability to attach the debugger to only certain Lambda functions. This targeted approach allows you to concentrate solely on the part of your system you’re currently working on or experiencing issues with. By avoiding the distraction of unrelated functions, you can work more efficiently and effectively resolve problems.

Observability Mode

In serverless development, developers typically work in personal environments to avoid affecting shared environment. However, if this isn’t feasible due to organizational or technical constraints, Observability Mode offers a perfect alternative.

With Observability Mode, you can debug AWS Lambda functions without interrupting their normal operation. This mode intercepts requests and sends them to your local machine for inspection, while the Lambda continues running in the cloud as usual. The response from your machine is ignored. It's ideal for debugging in production or shared environments where you can't modify code or pause execution.

Lambda Live Debugger samples requests at regular intervals (default is every 3 seconds) to prevent system overload, enabling real-time observation without impacting performance.

Supporting Any Framework

Lambda Live Debugger out of the box supports CDK, Serverless Framework v3, AWS Serverless Application Model (SAM) and Terraform. It is also flexible enough to work with any custom setup. You can customize or provide your own list of Lambdas by modifying lldebugger.config.ts.

export default {
  ...
  getLambdas: async (foundLambdas, config) => {
    return [
      {
          // function name as deployed on AWS
          functionName: "mystack-myfunction",
          codePath: "/src/myLambda.ts",
      },
    ];
  },
} satisfies LldConfigTs;
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
rdarrylr profile image
Darryl Ruggles

Looks really nice!