You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect an exception and the html page in my browser with debug information, but it shows plain text:
'Internal Server Error'.
Actual behavior
Browser shows plain text: 'Internal Server Error'
Debugging material
This is the traceback I see in terminal:
Traceback (most recent call last):
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/routing.py", line 582, in __call__
await route.handle(scope, receive, send)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/routing.py", line 243, in handle
await self.app(scope, receive, send)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/routing.py", line 54, in app
response = await func(request)
File "/home/avm/workspace/abug/main.py", line 7, in show_index
return JSONResponse({'hello': current_user})
NameError: name 'current_user' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 394, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 165, in __call__
response = self.debug_response(request, exc)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 245, in debug_response
content = self.generate_html(exc)
File "/home/avm/workspace/abug/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 221, in generate_html
traceback_obj.exc_traceback, limit # type: ignore
AttributeError: 'TracebackException' object has no attribute 'exc_traceback'
INFO: 127.0.0.1:48170 - "GET / HTTP/1.1" 500 Internal Server Error
Environment
OS: Debian bullseye
Python version: Python 3.9.1+
Starlette version: starlette==0.14.1
Additional context
It looks like something bad happens in middleware/errors.py - line 221. So... Is it a bug or am I doing something wrong and illegal?
The text was updated successfully, but these errors were encountered:
I have the same issue. exc_traceback got removed in Python 3.9 and 3.8.7 because it being there was wrong (https://bugs.python.org/issue42482).
Replacing traceback_obj.exc_traceback on line 221 with exc.__traceback__ works (it's the same object exc_traceback used to point at) but has the same issue because of which exc_traceback got removed in the first place, namely holding references.
Checklist
master
.Describe the bug
The application shows plain text instead of html page in debug mode when an error occurs.
To reproduce
I am trying to use the debug mode. Here is my application:
I start the server this way:
Expected behavior
I expect an exception and the html page in my browser with debug information, but it shows plain text:
'Internal Server Error'.
Actual behavior
Browser shows plain text: 'Internal Server Error'
Debugging material
This is the traceback I see in terminal:
Environment
Additional context
It looks like something bad happens in middleware/errors.py - line 221. So... Is it a bug or am I doing something wrong and illegal?
The text was updated successfully, but these errors were encountered: