I am deploying an rasa open source server (version 1.10.14) using docker and cloud foundry. To access the Internet from the deployment environment an proxy is used.
The proxy URL is set in the environment variables: http_proxy, HTTP_PROXY, https_proxy and HTTPS_PROXY.
For interaction with the bot Slack is used. When I send a message to the bot using Slack the bot receives the message, processes it and fails sending a response to Slack with the following error message:
2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR 2020-09-28 13:43:29 ERROR rasa.core.channels.slack - Exception when trying to handle message.Cannot connect to host www.slack.com:443 ssl:default [Connection refused] 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR 2020-09-28 13:43:29 ERROR rasa.core.channels.slack - Cannot connect to host www.slack.com:443 ssl:default [Connection refused] 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR Traceback (most recent call last): 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py”, line 936, in _wrap_create_connection 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “uvloop/loop.pyx”, line 1974, in create_connection 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “uvloop/loop.pyx”, line 1951, in uvloop.loop.Loop.create_connection 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR ConnectionRefusedError: [Errno 111] Connection refused 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR The above exception was the direct cause of the following exception: 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR Traceback (most recent call last): 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/channels/slack.py”, line 312, in process_message 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR await on_new_message(user_msg) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/channels/channel.py”, line 83, in handler 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR await app.agent.handle_message(*args, **kwargs) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/agent.py”, line 521, in handle_message 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR return await processor.handle_message(message) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py”, line 108, in handle_message 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR await self._predict_and_execute_next_action(message.output_channel, tracker) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py”, line 558, in _predict_and_execute_next_action 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR action, tracker, output_channel, self.nlg, policy, confidence 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py”, line 671, in _run_action 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR await self._send_bot_messages(events, tracker, output_channel) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/processor.py”, line 600, in _send_bot_messages 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR await output_channel.send_response(tracker.sender_id, e.message()) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/channels/channel.py”, line 186, in send_response 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR await self.send_text_message(recipient_id, message.pop(“text”), **message) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/rasa/core/channels/slack.py”, line 39, in send_text_message 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR channel=recipient, as_user=True, text=message_part, type=“mrkdwn”, 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/slack/web/base_client.py”, line 266, in _send 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR http_verb=http_verb, api_url=api_url, req_args=req_args 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/slack/web/base_client.py”, line 298, in _request 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR async with session.request(http_verb, api_url, **req_args) as res: 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/client.py”, line 1012, in aenter 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR self._resp = await self._coro 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/client.py”, line 483, in _request 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR timeout=real_timeout 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py”, line 523, in connect 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR proto = await self._create_connection(req, traces, timeout) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py”, line 859, in _create_connection 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR req, traces, timeout) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py”, line 1004, in _create_direct_connection 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR raise last_exc 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py”, line 986, in _create_direct_connection 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR req=req, client_error=client_error) 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR File “/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py”, line 943, in _wrap_create_connection 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR raise client_error(req.connection_key, exc) from exc 2020-09-28T15:43:29.69+0200 [APP/PROC/WEB/0] ERR aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.slack.com:443 ssl:default [Connection refused]
Seems like the Rasa Server or SlackClient is not able to connect to Slack to transmit the response. Are there any specific configurations to make or environment variables I have to set in addition to the proxy variables I already use?
When I curl -v https://www.slack.com
on the same Docker container, I at least get a response Code: 302
. This shows that the proxy-configuration using the environment variables should work.
Found rasa.core.channels.slack which references a possibility to set a proxy url for the slack client. But it seems to me that is is only for Rasa 2.0. (tried it with rasa 1.0 with no success)