Live Debugging AWS Lambda with Rookout - Does it Work?

Rookout's pros outweigh its cons.
Matt Skillman Featured
Matt Skillman | Jun 13 2022
3 min read

Rookout is a SaaS platform that offers a “Live Debugger” service, but there is little information online about how it works with AWS Lambda. So I tried it out and have some good news to report - it does work well with Lambda, though there are some problems.

Why do we care about Live Debugging?

AWS Lambda, when running “live” in AWS itself, does not support the attachment of debuggers. Because of this, when debugging an AWS Lambda function the normal workflow is either to hope that a function’s logs give you enough clues/hints or to run the code locally and attempt to replicate the issue. Debugging Lambda in this way is doable, but the purpose of Rookout is supposed to be that it makes the debugging process easier and faster.

What does the Live Debugger do?

The Live Debugger allows you to do exactly what Rookout says, which is set breakpoints that do not actually pause the execution of your function but do allow you to debug the function effectively. The Debugger allows you to both see the values of all local variables as well as see the breakpoint’s stack trace in the same way as any other debugger. For example, if I notice that my function is throwing a “list index out of range” then I can use Rookout to understand what this error means.

In the image above, we can see that there is a breakpoint on line 22. The “Variables” section in the bottom right corner shows us that the top_fruits list had a length of zero, which means that that top_fruits was the cause of the error.

In this particular case the stack trace is not important, but it is nice to know that this feature seems to work perfectly and would be useful when debugging a real application.

What are the bad parts about Rookout?

  1. From what I saw today when testing Rookout, an AWS Lambda function with a Python runtime that has the Rookout service running inside it will have cold start times that are roughly 2.5 seconds longer. Rookout’s docs claim that for Node the added cold start delay is only 500ms, which is still fairly significant.
  2. Surprisingly, when doing a “hello world” example for Rookout, you will encounter issues where the AWS Lambda will be unreachable [in the Rookout UI] after it finishes execution. Rookout will not allow you to view information about the AWS Lambda if it is not actively running. This is confusing for me because I thought that Rookout saves all of this data after the AWS Lambda completes its execution, so I do not understand why this limitation exists. To solve this problem, I wrote a script that constantly invokes the AWS Lambda.
  3. Google search results for anything related to Rookout are not very useful. Do not expect to easily find answers to any problems you might have. I would suggest to contact Rookout support rather than trying to search for answers on Google.
  4. The Python AWS Lambda quickstart guide is a bit outdated and does not use IAC. Also its runtime is Python 2, which was deprecated years ago. See my example for an alternative to the official quickstart guide.

Answers to your Rookout problems

Rookout says “No connected applications”

  • If using AWS Lambda, you will see this message about 5-10 seconds after your AWS Lambda finishes running. Consider invoking your AWS Lambda every few seconds to work around this issue.

My function is erroring 100% of the time but I am not seeing anything in the Rookout UI

  • If you look at the source code for the Rookout sdk for Python in, you may observe that the serverless_rook wrapper does not have a try/catch. Therefore, it is likely that if your functions throws an exception 100% of the time, then .flush() will never get called. I think that you have to hope that some of your executions are successful otherwise information might not make it into Rookout.

Rookout web UI shows stale code when using local filesystem, even after pushing the refresh button in the Rookout page

  • Hard refresh the webpage

Final Thoughts

All of the issues mentioned in this post probably have solutions that would be provided by Rookout support. I did not contact Rookout support because I wanted to truly experience what the first few hours of using Rookout would look like. In the future, if I am working with very complicated codebases running on AWS Lambda, I would be willing to use Rookout because I think its value outweighs the initial difficult parts of using the service.

Matt Skillman Featured
Matt Skillman