Docker Error: Cannot connect to host action_server:5055 ssl:default [Temporary failure in name resolution]

Action Server is working fine when I am running Rasa locally. But when I tried to docker, it is giving me the following error. I followed #Dockerizing my rasa chatbot application that has botfront post completely. But I am still getting the error. @nik202 please help.

2022-04-20 06:06:12,030 [ERROR]  Failed to run custom action 'action_about feature'. Couldn't connect to the server at 'http://action_server:5055/webhook'. Is the server running? Error: Cannot connect to host action_server:5055 ssl:default [Temporary failure in name resolution]
2022-04-20 06:06:12,031 [ERROR]  Encountered an exception while running action 'action_about feature'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 999, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 865, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/resolver.py", line 31, in resolve
    infos = await self._loop.getaddrinfo(
  File "uvloop/loop.pyx", line 1469, in getaddrinfo
socket.gaierror: [Errno -3] Temporary failure in name resolution

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

Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 722, in run
    response = await self.action_endpoint.request(
  File "/opt/venv/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 164, in request
    async with session.request(
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1011, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host action_server:5055 ssl:default [Temporary failure in name resolution]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 868, in _run_action
    events = await action.run(
  File "/opt/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 754, in run
    raise RasaException("Failed to execute custom action.")
rasa.shared.exceptions.RasaException: Failed to execute custom action.

Before this message I also got one more error related to socket io connection.

2022-04-20 06:05:52,725 [ERROR]  Exception occurred while handling uri: 'ws://localhost:5005/socket.io/?EIO=4&transport=websocket&sid=3g2wl1PXNTCDey57AAAA'
Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/sanic/server/protocols/websocket_protocol.py", line 119, in websocket_handshake
    subprotocols = list(subprotocols)
  File "/usr/lib/python3.8/typing.py", line 261, in inner
    return func(*args, **kwds)
  File "/usr/lib/python3.8/typing.py", line 685, in __getitem__
    params = tuple(_type_check(p, msg) for p in params)
  File "/usr/lib/python3.8/typing.py", line 685, in <genexpr>
    params = tuple(_type_check(p, msg) for p in params)
  File "/usr/lib/python3.8/typing.py", line 149, in _type_check
    raise TypeError(f"{msg} Got {arg!r:.100}.")
TypeError: Parameters to generic types must be types. Got 0.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "handle_request", line 83, in handle_request
    class Sanic(BaseSanic, metaclass=TouchUpMeta):
  File "/opt/venv/lib/python3.8/site-packages/engineio/asyncio_server.py", line 271, in handle_request
    packets = await socket.handle_get_request(environ)
  File "/opt/venv/lib/python3.8/site-packages/engineio/asyncio_socket.py", line 89, in handle_get_request
    return await getattr(self, '_upgrade_' + transport)(environ)
  File "/opt/venv/lib/python3.8/site-packages/engineio/asyncio_socket.py", line 142, in _upgrade_websocket
    return await ws(environ)
  File "/opt/venv/lib/python3.8/site-packages/engineio/async_drivers/sanic.py", line 122, in __call__
    self._sock = await protocol.websocket_handshake(request)
  File "/opt/venv/lib/python3.8/site-packages/sanic/server/protocols/websocket_protocol.py", line 132, in websocket_handshake
    raise ServerError(msg, status_code=500)
sanic.exceptions.ServerError: Failed to open a WebSocket connection.
See server log for more information.

@shree_123 first of all its the output of docker running code or localhost? For me, these errors are from a local machine? Honestly I not get you what is your main issue?

Its docker issue, the first code that I set mentions the error “Couldn’t connect to the server at ‘http://action_server:5055/webhook’. Is the server running? Error: Cannot connect to host action_server:5055 ssl:default [Temporary failure in name resolution]” in the first line.

I have tried everything, I followed multiple threads and changed my sanic, sanic-cors, engineio, socketio versions as well but nothing seems to work.

pip install sanic==21.6.0 pip install Sanic-Cors==1.0.0 pip install sanic-routing==0.7.0 engineio==4.2.1 socketio==5.4.0

Here are my Rasa versions:

Rasa Version : 3.0.6 Minimum Compatible Version: 3.0.0 Rasa SDK Version : 3.0.4 Rasa X Version : None Python Version : 3.8.12 Operating System : Windows-10-10.0.19042-SP0

Can we solve the issue on zoom, it will be better for me to explain it to you?

@shree_123 i’m sorry, my diary is full for the day, can’t make it to zoom.

If you saying its docker, share me the docker ps out

@shree_123 please follow this Dockerizing my rasa chatbot application that has botfront - #11 by nik202

delete import numpy as np in action.py or mention it in requirments.txt

If you need any help on deployment using ngrok please tag me.

Thankyou @nik202 for solving the issue. Cheers!!!

@shree_123 no worries, happy to help you and guide you all the questions :stuck_out_tongue: Good Luck!