honeybadger-io / honeybadger-python

Send Python and Django errors to Honeybadger.
https://www.honeybadger.io/
MIT License
15 stars 25 forks source link

Python AWS lambda errors are not picking up #159

Closed juagarcafc closed 7 months ago

juagarcafc commented 7 months ago

Following the code here doesn't seem to report an alert to HB, is this meant to work with only this config? I have used the js wrapper before and it does work, unfortunately this doesn't work for python.

from honeybadger import honeybadger
honeybadger.configure(api_key='Your project API key')

def lambda_handler(event, context):
    """
    A buggy lambda function that tries to perform a zero division
    """
    a = 1
    b = 0

    return (a/b) #This will be reported
subzero10 commented 7 months ago

Hello @juagarcafc, thank you for reporting an issue. How are you testing this lambda handler? If you are on a development environment, errors are not reported by default and the force_report_data setting needs to be set as well.

juagarcafc commented 7 months ago

Hi @subzero10 thank you for your reply.

I'm testing a deployed lambda on AWS by invoking it. I have amended the code for the below as you advised and unfortunately it still does not report the error to honeybadger

from os import environ

from honeybadger import honeybadger

honeybadger.configure(
    api_key=environ["HONEYBADGER_API_KEY"],
    environment="staging",
    force_sync=True,
    report_data=True,
)

def lambda_handler(event, context):
    """
    A buggy lambda function that tries to perform a zero division
    """
    a = 1
    b = 0

    return a / b  # This will be reported

FYI I'm able to report manual errors to honeybadger with the library, it won't just automatically report any runtime errors as the docs say it should.

subzero10 commented 7 months ago

Hey @juagarcafc, thanks for trying my suggestion. Let me try and reproduce this from my side and I will come back to you.

subzero10 commented 7 months ago

Hey @juagarcafc, I found the issue (#163). I will write here when the next version is released.

subzero10 commented 7 months ago

This should be fixed with v0.19.0!

juagarcafc commented 7 months ago

Thanks @subzero10 🙏🏼