Closed dotysan closed 1 year ago
Solution is to set HONEYBADGER_FORCE_REPORT_DATA=True. Why isn't this mentioned in the quickstart?!?
@dotysan glad you figured it out! It is mentioned (see the note under "Install Honeybadger"): https://github.com/honeybadger-io/honeybadger-python#install-honeybadger
This occurrs when HONEYBADGER_ENVIRONMENT is not set. I.e. 'production' by default.
This occurrs when HONEYBADGER_ENVIRONMENT is not set. I.e. 'production' by default.
I see—thanks for clarifying. @subzero10 @Kelvin4664 can you take a look at this next week? We should be reporting exceptions by default if there is no environment specified.
I started looking at the code and soon realized that the current implementation appears to be correct.
So, I created a sample repo and tried it out.
If you look at the code, I only set the api key. The environment is set to production
by default and the exception is reported to Honeybadger without any additional config.
@dotysan, I looked into the stack trace above and it seems you are running on Django.
For Django setups, we automatically set the environment to development
if DEBUG
is found in settings. Could this be the reason your exceptions are not reported by default?
@subzero10 Oh my, you found it! honeybadger/contrib/django.py#L102
And your own example sets DEBUG. examples/django_app/honeybadger_example/settings.py#L26
That explains things. However...
Here's my workflow. I'm a new user of hb. I already have DEV and PROD environments. First thing I'm going to do is install it in DEV and see what happens. Nowhere in the intro does it say Django's DEBUG will disable hb. And frankly, I disagree with that logic.
Anyhoo, thanks for looking into this. I had reviewed the code elsewhere in here but somehow missed django.py.
Hey @dotysan, I'm glad that we found the root of the issue. You are right, this is not documented anywhere. I will update our documentation to include this note.
As for the logic behind it, I'm not the original author of this piece of code and at first I was surprised to see it. However, I can understand why it's there. The package tries to make the best decision when it comes to the default config. So, it sees that Django is set on debug mode, indicating this is not a production environment, hence it makes sense not to set Honeybadger config in production.
Steps to reproduce.
Now that Django is up and running, then go to http://localhost:8000/api/div and whammo!
You get a 500. But nothing is sent to app.honeybadger.io. What am I doing wrong?