After initializing Sentry, I'm using sentry_sdk.init() to disable error reporting in some cases. However, when using Django Channels and the Django integration, this breaks something in the Daphne webserver. After this second call to init, any request leads to the following error:
Traceback (most recent call last):
File "<virtual env>/daphne/http_protocol.py", line 180, in process
"server": self.server_addr,
TypeError: __call__() missing 1 required positional argument: 'send'
HTTP GET / 500 [0.01, 127.0.0.1:51170]
You can find a minimal example with that behaviour in this repo.
The problem seems to be that the second call is missing the DjangoIntegration, it goes away when passing a new instance.
This might seem like a weird use of the SDK, but there does not seem to be another way to disable error reporting after init was called. This approach was suggested here as a workaround, since it removes the DSN. It should definitely not break the application though or at least be documented.
After initializing Sentry, I'm using
sentry_sdk.init()to disable error reporting in some cases. However, when using Django Channels and the Django integration, this breaks something in the Daphne webserver. After this second call toinit, any request leads to the following error:You can find a minimal example with that behaviour in this repo.
The problem seems to be that the second call is missing the
DjangoIntegration, it goes away when passing a new instance.This might seem like a weird use of the SDK, but there does not seem to be another way to disable error reporting after
initwas called. This approach was suggested here as a workaround, since it removes the DSN. It should definitely not break the application though or at least be documented.