Debug AWS Lambda functions with Thundra Online Debugging

Serverless Guru
Mar 16 · 7 min read

Today we are going to be talking about a cool offering from the folks over at Thundra called, Online Debugging. They’ve built something that is pretty interesting and I think everyone working in the serverless space will be excited to experiment with it.

High level summary

  1. Setup a Thundra account
  2. Thundra onboarding
  3. Build our AWS Lambda function
  4. Setup the AWS Lambda function
  5. Setup the Thundra VSCode plugin
  6. Online debugging
  7. Final Thoughts

Set up a Thundra account

The first thing we need to do is sign up for a Thundra account.

Sign Up

Then we can log in and get rolling.

Log In

Thundra onboarding

There are two paths when getting set up with Thundra, the pre-existing option is the Thundra Console and the new addition that this article is covering is the Thundra Debugger. Select Thundra Debugger.

Select “Start Debug”

Now we are prompted with an authentication key and a series of steps we need to follow to get the VSCode plugin setup.

NodeJS + VSCode integration

The first step is to install the Thundra Node.js agent which we are going to walkthrough below.

Build the AWS Lambda function

Typically an AWS Lambda function only requires a handful of files, especially when working with NodeJS.

Below we are creating our initial files and installing the @thundra/core npm dependency.

$: mkdir debugging
$: cd debugging
$: npm init -y
$: npm install --save @thundra/core
$: touch index.js

Now we can write our index.js file which will hold our business logic.

// index.js
const thundra = require("")();
exports.handler = thundra(async event => {
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
return response;

At the top, you can see that we are importing the @thundra/core dependency and then wrapping our exports.handler function code with the @thundra/core dependency. This wrapper code will connect all of our AWS Lambda executions back to the Thundra platform.

Once we have our function code updated, we need to zip the required AWS Lambda files. Then we can move to the AWS console.

$: zip index.js package.json node_modules -r

Setup the AWS Lambda function

Now that we have our AWS Lambda zip file ready to upload. We can navigate to the AWS Lambda console and create a function.

Create AWS Lambda function

Now we need to configure some details such as naming (thundraTest), setting up our runtime (NodeJS 12.x), and our AWS IAM role (lambda_basic_execution).

AWS Lambda create function settings

Once our AWS Lambda function is created we need to configure two environment variables:

  1. thundra_apiKey — during onboarding choose “Thundra Console” and you should see this value (optional)
  2. thundra_agent_lambda_debugger_auth_token — during onboarding choose “Thundra Debugging” and you should see this value
Set your Thundra API Key

Now it’s time to upload our AWS Lambda zip file from our previous steps.

AWS Lambda upload zip file

Once the zip file is uploaded we can now test our function.

AWS Lambda create test

Once we hit Test we should see the following result.

AWS Lambda test result

Once you have the AWS Lambda function successfully returning a 200 response. We then need to set up the VSCode plugin.

Setup the Thundra VSCode plugin

The first thing we need to do is simply install the Thundra VSCode plugin.

Thundra Debugger VS Code plugin

Next, we need to create a local file to authenticate our VSCode with our Thundra account.

$: touch debug-client.json

Now we need to set up the file by replacing <set-your-thundra-auth-token> with our Thundra auth token.

"profiles": {
"default": {
"debugger": {
"authToken": <set-your-thundra-auth-token>,
"sessionName": "default",
"brokerHost": "",
"brokerPort": 443

Now that the VSCode plugin is set up locally. We need to add another environment variable, thundra_agent_lambda_debugger_auth_token, to our deployed AWS Lambda function.

This extra environment variable will now cause our AWS Lambda function to connect to our VSCode environment.

Let’s take a look at using Thundra online debugging.

Online debugging with VSCode

Online debugging allows a developer to set breakpoints on live deployed AWS Lambda functions. To get this setup we need to walk through a couple of steps.

  1. Place breakpoints in your local code
  2. Run the Thundra: Start Debugger command
  3. Run your AWS Lambda function in the AWS Console

After the AWS Lambda function executes, you can step through each breakpoint and see the variables side-by-side.

First off we need to set breakpoints in our code. I’m just setting the breakpoint underneath the event.

Online debugging breakpoint

Then we need to start the debugger inside VSCode.

Online debugging start debugger

Then we need to switch back to the AWS console and invoke our AWS Lambda function.

Online debugging test

Make sure that you set the timeout pretty high on the function that you’re debugging. When you run the AWS Lambda function and it connects to VSCode it’s only open for a limited window. That window is whatever you set the AWS Lambda timeout too. If you set the timeout to 30 seconds, then you can only play around with the VSCode Online debugger for 30 seconds before it breaks. Based on the size of your AWS Lambda function you might want to have a timeout of a few minutes if you need additional time to process what values are being populated.

And once the connection is made, we should be able to step through our breakpoints one-by-one and debug those values.

Online debugging result

As you can see above the side panel is populated with variables from our live AWS Lambda function and you can see the event object had our test event we made previously when setting up the AWS Lambda function in the AWS console.

Final Thoughts

Overall I think the Thundra Online debugger is a powerful solution for developers looking to avoid emulating the cloud locally. By using the VSCode plugin you are utilizing real AWS resources and you’re able to debug a live deployed AWS Lambda function via breakpoints without needing to redeploy any code.

If you have any questions on the content covered, please comment below.

Next Steps

If you want to learn more about serverless, we’d highly recommend you check out more of our articles or other content.

Why Serverless Guru?

exists to be a change agent and overall guide to companies around the globe who are moving to serverless at scale. We help companies understand where serverless fits and where it doesn’t. Then we lay a proven roadmap to move them along in their serverless journey whether they are just getting started or already developing production serverless applications. If you’re looking for top-grade serverless consultants, send us an email at and we can schedule a quick call.

What did we miss?

When you leave your answer make sure to either comment below or tweet your answer to on Twitter because then we can quickly get back to you!

Ryan Jones

Founder, CEO/CTO —

LinkedIn —

Twitter —

Thanks for reading 😃

If you would like to learn more about , please follow us on , , , , or !

Serverless Guru

Serverless Guru exists to be a change agent and overall…

Serverless Guru

Written by

We can help you migrate to serverless, build serverless applications, and train your team on serverless best practices.

Serverless Guru

Serverless Guru exists to be a change agent and overall guide to companies around the globe whom are moving to serverless at scale. We help companies understand where serverless fits and where it doesn’t. Then we lay a proven roadmap to move them along in their serverless journey

More From Medium

More from Serverless Guru

More on Cloud Computing from Serverless Guru

More on Cloud Computing from Serverless Guru

Amazon API Gateway HTTP APIs with the Serverless Framework

More on Serverless from Serverless Guru

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade