What you expected to happen vs. what actually happened
I have an auth middleware that raises PermissionDenied. I'd expect this to retrun a 401 to client (as it does with http) but it doesn't. Instead the error goes uncaught.
How you're running Channels (runserver? daphne/runworker? Nginx/Apache in front?)
daphene
Console logs and full tracebacks of any errors
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/contrib/staticfiles/handlers.py", line 101, in __call__
return await self.application(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/channels/routing.py", line 62, in __call__
return await application(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/channels/routing.py", line 116, in __call__
return await application(
File "/src/config/middleware.py", line 45, in __call__
user = await authenticator.authenticate_headers(headers)
File "/usr/local/lib/python3.8/site-packages/asgiref/sync.py", line 479, in __call__
ret: _R = await loop.run_in_executor(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/asgiref/sync.py", line 538, in thread_handler
return func(*args, **kwargs)
File "/src/config/middleware.py", line 34, in authenticate_headers
raise PermissionDenied("Token is invalid or expired") from e
django.core.exceptions.PermissionDenied: Token is invalid or expired"
Please also try and include, if you can:
Minimal Code Sample
Your OS and runtime environment, and browser if applicable
python:3.8-slim
A
pip freeze
output showing your package versionsWhat you expected to happen vs. what actually happened
I have an auth middleware that raises PermissionDenied. I'd expect this to retrun a 401 to client (as it does with http) but it doesn't. Instead the error goes uncaught.
How you're running Channels (runserver? daphne/runworker? Nginx/Apache in front?)
daphene
Console logs and full tracebacks of any errors