I am building the rasa chatbot and trying to deploy it on messaging platforms like slack,telegram. The bot is working perfectly fine if I use ngrok for tunneling from my laptop onto slack. But when I deploy the same chatbot onto my server and run it, it returns with asyncio - Unclosed client session error.
For clarification, the server has a public url and i am able to do curl check onto it:
It works
Also, the slack app installer has accepted my webhook url:
But as soon as I send the text, it gives error in debug logs as :
LOGS
2020-06-11 06:34:22 DEBUG rasa.core.tracker_store - Creating a new tracker for id ‘UM0UF59J5’. 2020-06-11 06:34:22 DEBUG rasa.core.processor - Starting a new session for conversation ID ‘UM0UF59J5’. 2020-06-11 06:34:22 DEBUG rasa.core.processor - Action ‘action_session_start’ ended with events ‘[<rasa.core.events.SessionStarted object at 0x7fe9196ff7f0>, <rasa.core.events.ActionExecuted object at 0x7fe9196ffcc0>]’. 2020-06-11 06:34:22 DEBUG rasa.core.processor - Current slot values: option_form_input1: None option_form_input2: None option_form_input3: None option_form_input4: None option_form_input5: None option_selected: None requested_slot: None wish_chosen: None 2020-06-11 06:34:23 DEBUG rasa.nlu.classifiers.diet_classifier - There is no trained model for ‘ResponseSelector’: The component is either not trained or didn’t receive enough training data. 2020-06-11 06:34:23 DEBUG rasa.nlu.selectors.response_selector - Adding following selector key to message property: default 2020-06-11 06:34:23 DEBUG rasa.core.processor - Received user message ‘Hi’ with intent ‘{‘name’: ‘greet’, ‘confidence’: 0.9066393375396729}’ and entities ‘’ 2020-06-11 06:34:23 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 5 events. 2020-06-11 06:34:23 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {‘prev_action_listen’: 1.0, ‘intent_greet’: 1.0}] 2020-06-11 06:34:23 DEBUG rasa.core.policies.memoization - There is a memorised next action ‘utter_welcome’ 2020-06-11 06:34:23 DEBUG rasa.core.policies.form_policy - There is no active form 2020-06-11 06:34:23 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_0_MemoizationPolicy 2020-06-11 06:34:23 DEBUG rasa.core.processor - Predicted next action ‘utter_welcome’ with confidence 1.00. 2020-06-11 06:34:23 DEBUG rasa.core.processor - Action ‘utter_welcome’ ended with events '[BotUttered('Welcome to your Job Profile assistant ‘, {“elements”: null, “quick_replies”: null, “buttons”: null, “attachment”: null, “image”: null, “custom”: null}, {}, 1591875263.6727848)]’. 2020-06-11 06:34:25 DEBUG rasa.core.lock_store - Deleted lock for conversation ‘UM0UF59J5’. /usr/local/lib64/python3.6/site-packages/aiohttp/client.py:309: ResourceWarning: Unclosed client session <aiohttp.client.ClientSession object at 0x7fe9197a7b38> **kwargs) 2020-06-11 06:34:25 ERROR asyncio - Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7fe9197a7b38> source_traceback: Object created at (most recent call last): File “/usr/local/bin/rasa”, line 8, in sys.exit(main()) File “/usr/local/lib/python3.6/site-packages/rasa/main.py”, line 91, in main cmdline_arguments.func(cmdline_arguments) File “/usr/local/lib/python3.6/site-packages/rasa/cli/run.py”, line 114, in run rasa.run(**vars(args)) File “/usr/local/lib/python3.6/site-packages/rasa/run.py”, line 56, in run **kwargs, File “/usr/local/lib/python3.6/site-packages/rasa/core/run.py”, line 216, in serve_application endpoints.lock_store if endpoints else None File “/usr/local/lib/python3.6/site-packages/sanic/app.py”, line 1167, in run serve(**server_settings) File “/usr/local/lib/python3.6/site-packages/sanic/server.py”, line 920, in serve loop.run_forever() File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 126, in send return self.gen.send(value) File “/usr/local/lib/python3.6/site-packages/slack/web/base_client.py”, line 266, in _send http_verb=http_verb, api_url=api_url, req_args=req_args File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 110, in next return self.gen.send(None) File “/usr/local/lib/python3.6/site-packages/slack/web/base_client.py”, line 293, in _request auth=req_args.pop(“auth”, None), 2020-06-11 06:34:25 ERROR rasa.core.channels.slack - Exception when trying to handle message. 2020-06-11 06:34:25 ERROR rasa.core.channels.slack - Traceback (most recent call last): File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/slack.py”, line 312, in process_message await on_new_message(user_msg) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 83, in handler await app.agent.handle_message(*args, **kwargs) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/agent.py”, line 486, in handle_message return await processor.handle_message(message) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 108, in handle_message await self._predict_and_execute_next_action(message.output_channel, tracker) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 552, in _predict_and_execute_next_action action, tracker, output_channel, self.nlg, policy, confidence File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 665, in _run_action await self._send_bot_messages(events, tracker, output_channel) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 594, in _send_bot_messages await output_channel.send_response(tracker.sender_id, e.message()) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 186, in send_response await self.send_text_message(recipient_id, message.pop(“text”), **message) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/slack.py”, line 39, in send_text_message channel=recipient, as_user=True, text=message_part, type=“mrkdwn”, concurrent.futures._base.CancelledError 2020-06-11 06:34:25 WARNING rasa.core.channels.slack - Received retry #1 request from slack due to http_timeout.
LOGS END
Please help me out. The same error comes up when I deploy this on telegram that means there is not problem with a particular connector,
Also, one strange thing is that when I run a tunneling tool ie ngrok on my server machine and use that to deploy the bot on slack, it again starts working as normal.
Any help would be appreciated.