Closed zarevskaya closed 6 months ago
Hi @zarevskaya!
Thanks for bringing this to my attention.
The issue you've encountered stems from a mismatch between the WSGI protocol, which Flask inherently uses, and the ASGI protocol expected by Uvicorn. This discrepancy leads to the TypeError you're seeing, as Uvicorn attempts to invoke the application in a manner that's incompatible with a traditional WSGI application like Flask without an appropriate adapter or middleware.
Flask, being a synchronous framework, doesn't natively support asynchronous calls that ASGI servers like Uvicorn are designed to handle. The error is a direct result of this incompatibility. Essentially, Uvicorn is looking for an asynchronous entry point to the application but finds a synchronous Flask app instead, leading to the failure during startup.
To address this, I will be making several commits:
Introduce ASGI Compatibility: By using asgiref's WSGIAdapter, I will wrap the Flask application to make it compatible with ASGI expectations. This adapter acts as a bridge, allowing the Flask app to be served correctly by Uvicorn.
I'm currently working on these changes and will push the commits to our repository shortly. Once these updates are in place, I expect the application to run smoothly on our Debian 12 server with Docker, eliminating the internal error you've encountered.
Thank you for your patience as I work through these updates. Your report is invaluable in helping improve the application, and I'm committed to resolving this issue promptly. Also I'm excited to have first bug opened on this little hobby project of mine.
Cheers!
Thank you for your very complete response. Good luck with your work!
works for me now on debian @zarevskaya
Super! I'll try it when I wake up tomorrow.
Hi,
Thanks for sharing your work!
Debian 12 server + Docker.
Installed now and I have this issue:
Internal error.
Logs:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in call
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/asgi2.py", line 14, in call
TypeError: call() missing 1 required positional argument: 'start_response'
[2024-03-29 20:14:35 +0000] [10] [ERROR] Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in call
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/asgi2.py", line 14, in call