screenshot-to-code icon indicating copy to clipboard operation
screenshot-to-code copied to clipboard

ERROR: Exception in ASGI application

Open flyCat1350 opened this issue 2 years ago • 5 comments

Excuse me. Poetry (version 1.8.2) i'm getting error like this:

Traceback (most recent call last): File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1342, in _request response = await self._client.send( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 1617, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 1645, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpx/_client.py", line 1719, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpx/_transports/default.py", line 366, in handle_async_request resp = await self._pool.handle_async_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 268, in handle_async_request raise exc File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 251, in handle_async_request response = await connection.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpcore/_async/http_proxy.py", line 317, in handle_async_request stream = await stream.start_tls(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 78, in start_tls raise exc File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 69, in start_tls ssl_stream = await anyio.streams.tls.TLSStream.wrap( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/anyio/streams/tls.py", line 123, in wrap await wrapper._call_sslobject_method(ssl_object.do_handshake) File "/Users/*/Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/anyio/streams/tls.py", line 163, in _call_sslobject_method raise EndOfStream from None anyio.EndOfStream

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 250, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/fastapi/applications.py", line 276, in call await super().call(scope, receive, send) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/middleware/errors.py", line 149, in call await self.app(scope, receive, send) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/middleware/cors.py", line 75, in call await self.app(scope, receive, send) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call raise e File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 341, in handle await self.app(scope, receive, send) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 82, in app await func(session) File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/fastapi/routing.py", line 289, in app await dependant.call(values) File "/Users//Desktop/project/screenshot-to-code-main/backend/routes/generate_code.py", line 193, in stream_code completion = await stream_openai_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Desktop/project/screenshot-to-code-main/backend/backend/llm.py", line 26, in stream_openai_response stream = await client.chat.completions.create(params) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 1199, in create return await self._post( ^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1542, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1316, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1389, in _request return await self._retry_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1424, in _retry_request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1389, in _request return await self._retry_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users//Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1424, in _retry_request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "/Users/**/Library/Caches/pypoetry/virtualenvs/backend-_u0rSReM-py3.12/lib/python3.12/site-packages/openai/_base_client.py", line 1398, in _request raise APIConnectionError(request=request) from err openai.APIConnectionError: Connection error. INFO: connection closed

flyCat1350 avatar Mar 07 '24 12:03 flyCat1350

Looks like you're having issues connecting to the OpenAI API server.

abi avatar Mar 08 '24 01:03 abi

Looks like you're having issues connecting to the OpenAI API server.

Thanks a lot, i will have a try

flyCat1350 avatar Mar 08 '24 03:03 flyCat1350

I encountered the same error too, is there an issue with my OpenAI API key?

ymlzszs avatar Mar 12 '24 10:03 ymlzszs

No the issue is connecting to your OpenAI API server if this is the issue you're getting.

abi avatar Mar 12 '24 13:03 abi

Thanks a lot. I will check and try again.

ymlzszs avatar Mar 13 '24 04:03 ymlzszs

Closing due to inactivity

abi avatar May 23 '24 20:05 abi