-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Since yesterday, my Heroku Python app has been timing out on this line:
await api.metatrader_account_api.get_account(account_id)
However, making the same request with curl succeeds.
Because this is the first call before establishing the connection, its failure prevents the rest of the program from running.
Also, the exact same program on my local machine is working fine...
What could I be doing wrong?
This is the error I'm getting:
2025-10-21 09:13:25.286 | ERROR | src.utils.exception_logger:log_exception:101 - ❌ Failed to connect to Stream MetaAPI for f9d8bda2-a00d-4781-ba64-bb761aea3889
Exception type: httpx.ConnectTimeout
Exception message:
Exception args: ('',)
Request: <Request('GET', 'https://mt-provisioning-api-v1.agiliumtrade.agiliumtrade.ai/users/current/accounts/f9d8bda2-a00d-4781-ba64-bb761aea3889')>
Caused by: ConnectTimeout:
Context: ConnectTimeout:
Traceback:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
yield
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_transports/default.py", line 394, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
raise exc from None
File "/app/.heroku/python/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 "/app/.heroku/python/lib/python3.13/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
raise exc
File "/app/.heroku/python/lib/python3.13/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/httpcore/_async/connection.py", line 124, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<5 lines>...
)
^
File "/app/.heroku/python/lib/python3.13/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
with map_exceptions(exc_map):
~~~~~~~~~~~~~~^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/contextlib.py", line 162, in __exit__
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/app/.heroku/python/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 "/app/src/infrastructure/multi_account_stream_service.py", line 145, in _ensure_stream_connected
account = await api.metatrader_account_api.get_account(account_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/metaapi/metatrader_account_api.py", line 121, in get_account
account = await self._metatrader_account_client.get_account(account_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/metaapi/metatrader_account_client.py", line 509, in get_account
return await self._http_client.request(opts, 'get_account')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/http_client.py", line 113, in request
return await self.request(options, type, retry_counter, end_time)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/http_client.py", line 113, in request
return await self.request(options, type, retry_counter, end_time)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/http_client.py", line 113, in request
return await self.request(options, type, retry_counter, end_time)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Previous line repeated 2 more times]
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/http_client.py", line 112, in request
retry_counter = await self._handle_error(err, type, retry_counter, end_time)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/http_client.py", line 165, in _handle_error
raise error
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/http_client.py", line 89, in request
response = await self._make_request(options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/metaapi_cloud_sdk/clients/http_client.py", line 134, in _make_request
response = await client.send(req)
^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_client.py", line 1629, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<4 lines>...
)
^
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_client.py", line 1657, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_client.py", line 1694, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_client.py", line 1730, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_transports/default.py", line 393, in handle_async_request
with map_httpcore_exceptions():
~~~~~~~~~~~~~~~~~~~~~~~^^
File "/app/.heroku/python/lib/python3.13/contextlib.py", line 162, in __exit__
self.gen.throw(value)
~~~~~~~~~~~~~~^^^^^^^
File "/app/.heroku/python/lib/python3.13/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectTimeout
Please help, me and my customers are stuck on this and the Support service is not replying to my requests...
965311532
Metadata
Metadata
Assignees
Labels
No labels