Sentry integration with Channels-Daphne ERROR 500
Daphne is the recommended WebServer to run the channels library for WebSockets with Django. The way to deploy daphne is by using this asgi.py file (see: https://channels.readthedocs.io/en/latest/deploying.html)
The versions I am using:
- Daphne: 2.2.0
- Channels: 2.1.2
- Raven Python: 6.9.0
import os
import django
from channels.routing import get_default_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
django.setup()
application = get_default_application()
But once I follow the sentry integration with Django tutorial and I wrap the channel's get_default_application() with the Sentry application wrapper:
import os
import django
from channels.routing import get_default_application
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
django.setup()
application = Sentry(get_default_application())
Daphne starts returning Error 500 to all requests:
<html> <head> <title>500 Internal Server Error</title> <style> body { font-family: sans-serif; margin: 0; padding: 0; } h1 { padding: 0.6em 0 0.2em 20px; color: #896868; margin: 0; } p { padding: 0 0 0.3em 20px; margin: 0; } footer { padding: 1em 0 0.3em 20px; color: #999; font-size: 80%; font-style: italic; } </style> </head> <body> <h1>500 Internal Server Error</h1> <p>Daphne HTTP processing error</p> <footer>Daphne</footer> </body> </html>
Without the Sentry wrapper, Channels/Daphne works well. Any workarounds? Solutions? Thanks!
Might be way off the mark with this but could it be that Daphne is ASGI and Sentry is for WSGI?
Sentry supports Tornado using the raven.contrib.tornado.AsyncSentryClient -- I'm sure something like that could be written for ASGI support?