By using AWS Lambda Debugger VS Code Extension, you can debug your serverless applications natively with their permissions.
Debugging means replaying the execution of an application in some means. Where in serverless applications, more specifically in AWS Lambda applications, replaying the same invocation is not always possible due to its black-box nature.
By using Thundra’s AWS Lambda Debugger VS Code Extension, you can debug your serverless applications natively with their permissions.
Benefits
No local issue reproduction, debug Lambda applications during the invocation execution.
Do not stop the whole process, debug/stop 1 Lambda invocation at a time.
No mocking resources and simulating the environments
Installation
To use AWS Lambda Debugger, you need to complete all installation steps. Please follow the instructions below.
and get your THUNDRA_AGENT_LAMBDA_DEBUGGER_AUTH_TOKEN. You can get your auth token from the if you've already signed up.
Add this key to both your VS Code configuration and your AWS Console:
Open the Command Palette (⇧⌘P) and select Thundra: Edit Configuration command to paste the auth token to the authToken field
Go to your AWS Console and set your auth token value with the THUNDRA_AGENT_LAMBDA_DEBUGGER_AUTH_TOKEN key as your environment variable.
After installing the extension, instrument your AWS Lambda. You can do it in two ways.
Using Layers (easier)
Manual instrumentation
How to use
Click on the “Start Thundra Debugger” button on the Status Bar. You can also execute the command Thundra: Start Debugger to start the debugging session.
Set a debug point on your VS Code. You can set multiple debug points as well.
Now invoke your AWS Lambda function to hit on the debug point.
When there is a hit on your breakpoint, the status bar below turns red.
You can start debugging when the variables and the call stack are loaded.
Debug session ends when your AWS Lambda function times out. You can update the timeout of your function for longer debug sessions.
Summary
Traditionally, it is impossible to put breakpoints in a Lambda function, stop the execution and debug as usual. Debugging serverless applications locally may make sense in some situations. But it is clear that mocking the cloud environment and debugging serverless applications locally misses some crucial points such as security permissions and authenticity of event data flowing between resources.
You can ease those pains by installing just a single VSCode extension, instrumenting your function without any further steps.