zappa-sentry, automatic integration of zappa and sentry

Want to know when something goes wrong in a lambda? Tired of replicating all your alarm setup for each lambda?

If you just want a simple setup on each lambda that guarantees that you get alerts with enough information to be actionable, zappa-sentry is for you.

You'll need a sentry project DSN. If you don't have one or don't even have an account you can create one for free at https://sentry.io/

How to use?

First, install the zappa-sentry in your lambda's virtual environment with: pip install zappa-sentry (if you're using a requirements.txt to manage dependencies don't forget to add zappa-sentry to it).

Next, setup your sentry DSN as the value of environment variable SENTRY_DSN, either on the zappa_setting.json file or in any of the other methods on https://github.com/miserlou/zappa/#setting-environment-variables

Then you can setup the zappa_sentry.unhandled_exceptions handler.

Example:

{
    "dev": {
        ...
        "environment_variables": {
            "SENTRY_DSN": "https://*key*:*pass*@sentry.io/*project*",
            ...
        },
        "exception_handler": "zappa_sentry.unhandled_exceptions",
        ...
    },
    ...
}

And that's all. Deploy your zappa function and you should see any errors appearing on sentry.

links

social