jocxfin / pwgen

Simple self hosted password generator
GNU Affero General Public License v3.0
53 stars 3 forks source link

Internal error #15

Closed zarevskaya closed 6 months ago

zarevskaya commented 6 months ago

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

result = await app(  # type: ignore[func-returns-value]

File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in call

return await self.app(scope, receive, send)

File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/asgi2.py", line 14, in call

instance = self.app(scope)

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

result = await app(  # type: ignore[func-returns-value]

File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in call

return await self.app(scope, receive, send)

File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/asgi2.py", line 14, in call

instance = self.app(scope)
jocxfin commented 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:

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!

zarevskaya commented 6 months ago

Thank you for your very complete response. Good luck with your work!

jocxfin commented 6 months ago

works for me now on debian @zarevskaya

zarevskaya commented 6 months ago

Super! I'll try it when I wake up tomorrow.