Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpx.ConnectTimeout #212

Open
mohammadhasananisi opened this issue Nov 23, 2024 · 1 comment
Open

httpx.ConnectTimeout #212

mohammadhasananisi opened this issue Nov 23, 2024 · 1 comment
Labels
more info needed More info is needed in order to address the issue

Comments

@mohammadhasananisi
Copy link

P/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 72, in map_httpcore_exceptions
yield
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 377, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
raise exc from None
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request
response = await connection.handle_async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pool_request.request
^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
raise exc
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpcore/_async/connection.py", line 156, in _connect
stream = await stream.start_tls(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 67, in start_tls
with map_exceptions(exc_map):
~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/mohammadhasananisi/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 162, in exit
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectTimeout

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

Traceback (most recent call last):
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self.scope, self.receive, self.send
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/applications.py", line 113, in call
await self.middleware_stack(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/routing.py", line 715, in call
await self.middleware_stack(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/app/auth/router.py", line 52, in auth_google_callback
user = await google_sso.verify_and_process(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/fastapi_sso/sso/base.py", line 394, in verify_and_process
return await self.process_login(
^^^^^^^^^^^^^^^^^^^^^^^^^
...<7 lines>...
)
^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/fastapi_sso/sso/base.py", line 565, in process_login
response = await session.get(uri)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_client.py", line 1814, in get
return await self.request(
^^^^^^^^^^^^^^^^^^^
...<9 lines>...
)
^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_client.py", line 1585, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_client.py", line 1674, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
)
^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_client.py", line 1702, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_client.py", line 1739, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_client.py", line 1776, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 376, in handle_async_request
with map_httpcore_exceptions():
~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Users/mohammadhasananisi/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 162, in exit
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/Users/mohammadhasananisi/Desktop/work/oneprop/backend/venv/lib/python3.13/site-packages/httpx/_transports/default.py", line 89, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectTimeout

@tomasvotava
Copy link
Owner

Hey @mohammadhasananisi and thanks for the issue!
In most cases ConnectTimeout happens when there are some underlying network issues, can you confirm that this is still happening? Also, could you please provide a code sample and lastly, please post logs as code snippets, so that they are more readable, thanks! 🙏

@tomasvotava tomasvotava added the more info needed More info is needed in order to address the issue label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed More info is needed in order to address the issue
Projects
None yet
Development

No branches or pull requests

2 participants