honeybadger-io / honeybadger-python

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

AttributeError: module 'bootstrap' has no attribute 'handle_event_request' #79

Closed joshuap closed 3 years ago

joshuap commented 3 years ago

A bug report from a customer:

Using Zappa with Django. Everything worked fine on honeybadger==0.4.2 As soon as I updated to 0.5.0 my lambda function was unable to boot and last lines were about HB.

[ERROR] AttributeError: module 'bootstrap' has no attribute 'handle_event_request'
Traceback (most recent call last):
  File "/var/task/handler.py", line 609, in lambda_handler
    return LambdaHandler.lambda_handler(event, context)
  File "/var/task/handler.py", line 240, in lambda_handler
    handler = cls()
  File "/var/task/handler.py", line 146, in __init__
    wsgi_app_function = get_django_wsgi(self.settings.DJANGO_SETTINGS)
  File "/var/task/zappa/ext/django_zappa.py", line 20, in get_django_wsgi
    return get_wsgi_application()
  File "/var/task/django/core/wsgi.py", line 13, in get_wsgi_application
    return WSGIHandler()
  File "/var/task/django/core/handlers/wsgi.py", line 127, in __init__
    self.load_middleware()
  File "/var/task/django/core/handlers/base.py", line 58, in load_middleware
    mw_instance = middleware(adapted_handler)
  File "/var/task/honeybadger/contrib/django.py", line 105, in __init__
    honeybadger.configure(**config_kwargs)
  File "/var/task/honeybadger/core.py", line 57, in configure
    self.auto_discover_plugins()
  File "/var/task/honeybadger/core.py", line 64, in auto_discover_plugins
    default_plugin_manager.register(contrib.AWSLambdaPlugin())
  File "/var/task/honeybadger/contrib/aws_lambda.py", line 81, in __init__
    self.initialize_request_handler(lambda_bootstrap)
  File "/var/task/honeybadger/contrib/aws_lambda.py", line 127, in initialize_request_handler
    original_event_handler = lambda_bootstrap.handle_event_request
kpavlovsky commented 3 years ago

following

Kelvin4664 commented 3 years ago

@joshuap the thought of this possibility prompted me to open #77 I'll make a hotfix to ignore lambda integration when an integration (flask/django) is already active and then work on #77 to allow all the integrations co-exist

joshuap commented 3 years ago

@Kelvin4664 sounds good, thanks!

Kelvin4664 commented 3 years ago

following

Hi @kpavlovsky Please can you confirm your python and django version?

kpavlovsky commented 3 years ago

@Kelvin4664 Django==3.1.7 "runtime": "python3.8"

kpavlovsky commented 3 years ago

Let me know as soon as there is anything to test, so I can provide feedback on the fix.

cheers!

Kelvin4664 commented 3 years ago

@kpavlovsky fix is available. you can test now..

joshuap commented 3 years ago

@kpavlovsky fix is available. you can test now..

*note the fix is currently on the master GitHub branch. Can you test it from there to confirm that it works? You can also wait for a release if you want, I'll probably do that tomorrow.

kpavlovsky commented 3 years ago

@joshuap Thanks for the quick turnaround with this problem, my friends!

I think I'll be able to test it only tomorrow.

I'll let you know.

kpavlovsky commented 3 years ago

With a great overdue - yeah that has fixed the problem.

Installed from github.

Still don't see new release on PYPI :)

Thanks a lot

joshuap commented 3 years ago

@kpavlovsky I just released 0.6.0 if you want to lock back to PyPi. Thanks for confirming!