Socket Channel not working in rasa 3.1.0

Dependency install :-

python - 3.8

requests (2.27.1)
rsa (4.8)
sanic-routing (0.7.2)
websockets (10.3)
sanic (21.12.1)
python-engineio (4.3.2)
sanic-cors (2.0.1)
scipy (1.7.3)
python-socketio (5.6.0)
rasa-sdk (3.1.1)
sanic-jwt (1.7.0)
webexteamssdk (1.6)

We are using rasa 3.1.0 but i am getting socket error

Error 1:

[2022-05-05 12:00:55 +0000] [1] [ERROR] Exception occurred while handling uri: ‘ws://chatbot-wd.moglix.com/socket.io/?EIO=4&transport=websocket&sid=TX9cEnlx6hY2ED9rAACU’ Traceback (most recent call last): File “handle_request”, line 124, in handle_request sanic.exceptions.ServerError: Invalid response type None (need HTTPResponse)

Error 2:

2022-05-05 11:54:28 ERROR asyncio - Task was destroyed but it is pending! source_traceback: Object created at (most recent call last): File “/opt/venv/bin/rasa”, line 8, in sys.exit(main()) File “/opt/venv/lib/python3.8/site-packages/rasa/main.py”, line 119, in main cmdline_arguments.func(cmdline_arguments) File “/opt/venv/lib/python3.8/site-packages/rasa/cli/run.py”, line 95, in run rasa.run(**vars(args)) File “/opt/venv/lib/python3.8/site-packages/rasa/api.py”, line 56, in run rasa.core.run.serve_application( File “/opt/venv/lib/python3.8/site-packages/rasa/core/run.py”, line 225, in serve_application app.run( File “/opt/venv/lib/python3.8/site-packages/sanic/app.py”, line 1204, in run serve_single(server_settings) File “/opt/venv/lib/python3.8/site-packages/sanic/server/runners.py”, line 206, in serve_single serve(**server_settings) File “/opt/venv/lib/python3.8/site-packages/sanic/server/runners.py”, line 155, in serve loop.run_forever() File “/opt/venv/lib/python3.8/site-packages/engineio/asyncio_socket.py”, line 147, in websocket_wait data = await ws.wait() File “/opt/venv/lib/python3.8/site-packages/engineio/async_drivers/sanic.py”, line 134, in wait data = await self._sock.recv() File “/opt/venv/lib/python3.8/site-packages/sanic/server/websockets/impl.py”, line 521, in recv done, pending = await asyncio.wait( File “/usr/lib/python3.8/asyncio/tasks.py”, line 424, in wait fs = {ensure_future(f, loop=loop) for f in set(fs)} File “/usr/lib/python3.8/asyncio/tasks.py”, line 424, in fs = {ensure_future(f, loop=loop) for f in set(fs)} task: <Task pending name=‘Task-33635’ coro=<WebsocketFrameAssembler.get() running at /opt/venv/lib/python3.8/site-packages/sanic/server/websockets/frame.py:117> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f7068c2f0a0>()] created at /usr/lib/python3.8/asyncio/locks.py:306> created at /usr/lib/python3.8/asyncio/tasks.py:424>

Please help us here

@nitishranjan well there is not an exact fix but each system has different issues so please ref this thread: Rasa 3.0 error socket.io - #13 by nik202

It’s just a matter of the sanic version meeting the compatibilities and all will be sorted. Good Luck!

@nik202 Still we are facing same issue

I’m facing the same issue with Rasa 2.8.32. I’ve tried a few different versions of python-socketio but no luck.

Oddly enough, this works locally, but not on our production server. Trying to figure out whether my issue is really to do with my server config rather than package versions.

Is this what @nitishranjan you and others are experiencing? From the posts I’ve read it seems as though it doesn’t work regardless of localhost or other domain.

EDIT:

I should mention I am using a custom connector, with the following packages:

sanic 21.12.1
Sanic-Cors 2.0.1
sanic-jwt 1.8.0
sanic-routing 0.7.2
python-engineio 4.3.3
python-socketio 5.7.0

I’ve confirmed these are the same locally as on production server.

Ahah! These errors being the same were not the same issue at all! Turns out I didn’t configure an upstream for websockets on nginx as is suggested here: How do I make rasa webchat work with nginx and https? | DigitalOcean