bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.21k stars 682 forks source link

Fails to establish websocket connection in cloud deployment #1025

Closed Drake1804 closed 5 months ago

Drake1804 commented 5 months ago

Hello,

I've been using cryptofeed for my application and it runs perfectly when I execute it locally. However, when I attempt to deploy the application in a Docker container on Google Cloud Run, I encounter an issue: the subscription fails to establish a connection, resulting in a timeout error.

I've made sure to expose port 8080, but the problem persists. Could it be that additional ports need to be exposed, or might there be another configuration I'm overlooking? Any advice or suggestions you could offer would be greatly appreciated.

Thank you!

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/cryptofeed/connection_handler.py", line 59, in _create_connection
    async with self.conn.connect() as connection:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/site-packages/cryptofeed/connection.py", line 104, in connect
    await self._open()
  File "/usr/local/lib/python3.10/site-packages/cryptofeed/connection.py", line 318, in _open
    self.conn = await websockets.connect(self.address, **self.ws_kwargs)
  File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 646, in __await_impl_timeout__
    async with asyncio_timeout(self.open_timeout):
  File "/usr/local/lib/python3.10/site-packages/websockets/legacy/async_timeout.py", line 169, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/websockets/legacy/async_timeout.py", line 252, in _do_exit
    raise asyncio.TimeoutError