honeybadger-io / honeybadger-python

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

Error when using honeybadger with AWS Lambda with python 3.10 #141

Open samuelcea opened 1 year ago

samuelcea commented 1 year ago

Hello,

I'm having a problem when trying to get Honeybadger workiing with an AWS Lambda with python 3.10 (recently released), i'm following the code exposed on the docs to configure honeybadger on lambdas and it doesn't show more than just configuring it, but when an error is raised it doesn't get it and the logs shows this Lambda function not wrapped by honeybadger: module '__main__' has no attribute 'handle_event_request', if i call .notify inside the code it works, but when an unexpected exception is raised, it's not triggered to HB.

This is my code

honeybadger.configure(api_key=Settings.HONEYBADGER_API_KEY, environment=Settings.ENVIRONMENT)

def handler(event: dict, context: LambdaContext) -> None:  # dead: disable
    try:
        logger.info(f"event: {event} context {context}")
        for record in chain.from_iterable(event["records"].values()):
            # example code
    except Exception as e:
        honeybadger.notify(e)
        raise e

I need to clarify that the api_key is correctly and the environment too, if not, i shouldn't be getting the error on my HB dashboard.

subzero10 commented 1 year ago

Hey @samuelcea, thanks for submitting an issue! We'll take a look.