rasa: Socket Channel not working in rasa 3.0.0
Rasa Open Source version
3.0.0
Rasa SDK version
3.0.0
Rasa X version
No response
Python version
3.8
What operating system are you using?
Linux
What happened?
Using the rasa chat widget to talk to the bot throws the following exception in rasa 3.0.0:
[2021-11-28 13:09:58 +0000] [4700] [ERROR] Exception occurred while handling uri: 'http://localhost:5005/socket.io/?EIO=4&transport=polling&t=Nrcgg60'
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 317, in handle_request
return await self._make_response(r, environ)
File "/opt/venv/lib/python3.8/site-packages/engineio/asyncio_server.py", line 385, in _make_response
response = make_response(
File "/opt/venv/lib/python3.8/site-packages/engineio/async_drivers/sanic.py", line 102, in make_response
return HTTPResponse(body=payload, content_type=content_type,
TypeError: 'NoneType' object is not callable
This did not happen in rasa 2.8.15.
This repo contains a reproducible example.
Command / Request
No response
Relevant log output
No response
Definition of done
- Determine if the cause is in Rasa Open Source 3.0
- If the problem is in
Rasa Chat Widget, update this issue and move toFabricbacklog - Try to add test for this?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 28 (9 by maintainers)
python-engineiohas released a new version with the fix: 4.3.1 🎉I am facing similar error with rasa 3.0.1 I just added https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js on my index.html
I tried installing @nimitkh version using poetry but I got a version error with sanic==21.6.0 and sanic-routing==0.7.0
I have experimented this on rasa/webchat/ and it’s working fine on rasa 3.0 [MacOS] with:
i figured out what i was doing wrong. like you say https://github.com/botfront/rasa-webchat does work fine with Rasa 3.x.
first thing i hadn’t done was in credentials.yml i had
session_persistence: true/falseinstead of justsession_persistence: true, but that wasn’t the issue.i updated the index.html file so it had
socketUrl: "http://<MY_EC2_PUBLIC_IP>:5005"when i ran the web server i still got errorGET http://<MY_EC2_PUBLIC_IP>:5005/socket.io/?EIO=3&transport=polling&t=OIt2MeS 400 (Bad Request)but when i create EC2 Security > Inbound rule to allow port forwarding on 5000 and 5005 on TCP 0.0.0.0/0 it still didn’t work, but then i noticed in the terminal window of the Rasa server where i’d run
python -m rasa run --enable-api --cors "*", it had an error shown:Rasa server is up and running. The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO).so given that i knew that
EIOwas an abbreviation for the EngineIO version since i recently answered this stackoverflow question https://stackoverflow.com/questions/74265891/what-is-eio-3transport-pollingt-in-socket-io/74508268#74508268, i quicky checked that the Rasa server was runningbut the error was telling me that the client was using an unsupported version, which was EngineIO v3, since the query string parameters from the client were
EIO=3, so i needed it to showEIO=4instead…in index.html i was using
<script src="https://cdn.jsdelivr.net/npm/rasa-webchat@1.5.0/lib/index.min.js" type="text/javascript"></script>, but when i changed@1.5.0to@1.0.0or removed the version number so it became<script src="https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.min.js" type="text/javascript"></script>it gave me an error sayingWebChat.default.initis undefined, so i simply changed that code toWebChat.defaultinstead ofWebChat.default.init, since the latest version doesn’t use.init. See https://github.com/botfront/rasa-webchat/blob/master/dev/src/index.html#L8, and when i did that and restarted the Flask server and refreshed the webpage at http://<MY_EC2_PUBLIC_IP>:5000 it finally worked@ltfschoen I have several bots working with the botfront widget and 3.x here. They’re all on various 3.x releases.
The socket issue still persists even with the latest Rasa version (3.2.4). I’m using rasa-webchat as the chat interface. The issue can be reproduced by:
Version Reference:
@amn41 may have discovered a different issue with
python-engineio4.3.1andsanic21.9.3Using
sanic21.6.0andpython-engineio4.3.1works.I see something similar with Rasa 3.4.0 from the official docker image (rasa/rasa:3.4.0-full) and recent versions of FF and Chrome using the web widget Rasa recommends in the docs, but it appears to only happen on refresh. Start a chat, works fine, hit refresh, get this error server side:
Note that I do not get the
The client is using an unsupported version of the Socket.IO or Engine.IO protocolsmessage some other people saw for similar errors in forum threads I researched.My credentials.yml settings for socketio are as follows:
Again, the initial chat works fine, this happens when refreshing the page. Perhaps it’s a new/different bug?
I’ve seen some people recommend Botfront but that project appears to be dead.
This fix is not released yet and will be released in 3.1
It’s now fixed in the
python-engineiorepo, I’ve just asked for a pypi release@Italosayan It is 3.7.7
I made some investigation and here are the results: Unfortunately, we have to wait for
python-engineioto get fixed (https://github.com/miguelgrinberg/python-engineio/issues/251) because we made a bunch of changes to how we usesanic, and downgrading it to21.6.0makes little sense because in this case we would need to revert our changes, and that can potentially lead to issues withrasa-sdkas well.We can speed things up a bit by fixing this issue: https://github.com/miguelgrinberg/python-engineio/issues/251