I have bot deployed in aws with HTTPS and using rasa webchat script on one of my website which is also on HTTPS and I am getting the error on website for the bot to load.
WebSocket connection to 'wss://rasa-aws-url:82/socket.io/?EIO=4&transport=websocket&sid=FMfJTJy9o8KI15IbAAFH 'failed
and sometimes
WebSocket connection to 'wss://rasa-aws-url:82/socket.io/?EIO=4&transport=websocket&sid=dfSA6Yxg1H9z3BnvAAF1 ’ failed: Error during WebSocket handshake: Unexpected response code: 200
If I refresh the page sometimes the bot is loading and sometimes getting disconnected because of above error, and launcher image is also not loading and coming like
Everything is working perfectly on local but when it deployed on HTTPS all the new issues are rising.
when the bot is getting disconnected the logs of rasa as follows
2021-10-22 08:44:03,746 [ERROR] Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None) created at C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\proactor_events.py:385>
source_traceback: Object created at (most recent call last):
File "C:\Users\Administrator\Desktop\project\venv\lib\site-packages\rasa\core\run.py", line 220, in serve_application
app.run(
File "C:\Users\Administrator\Desktop\project\venv\lib\site-packages\sanic\app.py", line 1111, in run
serve(**server_settings)
File "C:\Users\Administrator\Desktop\project\venv\lib\site-packages\sanic\server.py", line 912, in serve
loop.run_forever()
File "C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\windows_events.py", line 316, in run_forever
super().run_forever()
File "C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\base_events.py", line 570, in run_forever
self._run_once()
File "C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\base_events.py", line 1851, in _run_once
handle._run()
File "C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\proactor_events.py", line 385, in _loop_writing
self._loop.call_soon(self._call_connection_lost, None)
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\Administrator\Desktop\Python3.8.6 base\Python38\lib\asyncio\proactor_events.py", line 162, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
My bot script on website
<script>
!(function () {
let e = document.createElement("script"),
t = document.head || document.getElementsByTagName("head")[0];
(e.src ="https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.1/lib/index.js"),
(e.async = !0),
(e.onload = () => {
window.WebChat.default(
{
initPayload: '/greet',
title: 'AI Assistant',
socketPath: "/socket.io/",
profileAvatar: 'logo.jpeg',
openLauncherImage: 'logo.jpeg',
socketUrl: "https://rasa-aws-url:82/",
customData: { language: "en"},
params: {storage: "session"},
},
);
}),
t.insertBefore(e, t.firstChild);
})();
</script>
Rasa Version : 2.7.0
Minimum Compatible Version: 2.6.0
Rasa SDK Version : 2.7.0
Rasa X Version : None
Python Version : 3.8.7
python-engineio : 4.2.1
python-socketio : 5.4.0
websockets : 8.1
I am not able to figure out where the root cause is and how to resolve and I know rasa webchat is handled by botfront, raised issues on their github with no luck, hoping someone else faced the issue and resolved it. Please help me.