Nothing came up.

Try with different keywords or contact using the chat bubble.

Back to article.

Best Practices - Error Handling With AWS Lambda And Python

If you are running Python on AWS Lambda, you can catch and get alerted for all errors with Dashbird.

Dashbird detects the following types of errors

  • Exceptions
  • Errors
  • Configuration errors
  • Timeouts

Errors are detected and parsed Python exceptions and runtime errors from CloudWatch logs, meaning that developers do not need to attach any agents inside their code.

In addition, with each error, you get the context. Logs of the whole invocation, along with memory usage, duration and other meaningful metrics.

On top of that, Dashbird groups similar errors, making it possible to estimate the scope of the problem and make debugging easier. For example, it might help to better observe the problem if you find some commonalities in the executions.

Here’s how a Python error looks like in Dashbird. Python Error Dashbird

Exceptions

You can find the complete list of Python exceptions here.

Exceptions are parsed out automatically in Dashbird, and include a rundown of traceback and logs of the specific invocation.

Missing module

Another scenario for errors in AWS Lambda is when you have a third-party module imported in your function code but not found in your Lambda deployment package.

Obs.: Python built-in modules are available out-of-the-box in the Lambda environment, you obviously don’t need to worry about them. Also, boto3 is available in all Python functions by default, there’s no need to include in your Lambda packages.

Here’s how it looks like:

START RequestId: db1e9421-724a-11e7-a121-63fe49a029e8 Version: $LATEST

Unable to import module 'lambda_funxction': No module named 'lambda_funxction'

REPORT RequestId: db1e9421-724a-11e7-a121-63fe49a029e8  Duration: 15.11 ms Billed Duration: 100 ms  Memory Size: 128 MB  Max Memory Used: 18 MB

AWS Lambda errors

Apart from Python specific errors, programmers have to think about failures that are specific to Lambda functions. In Runtime-agnostic Best Practices we have covered most of the problems that cause headaches to serverless developers.


We aim to improve Dashbird every day and user feedback is extremely important for that, so please let us know if you have any feedback about our features and error handling! We would really appreciate it!

Can't find what you're looking for? We'd love to help. Send us a message through the chat bubble or email us.