Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket Version Incompatible with Rasa 3.0 #11084

Closed
arabellastrange opened this issue Apr 14, 2022 · 10 comments
Closed

Websocket Version Incompatible with Rasa 3.0 #11084

arabellastrange opened this issue Apr 14, 2022 · 10 comments
Labels
area:rasa-oss/channels 📞 Issues focused around rasas input and output channels area:rasa-oss 🎡 Anything related to the open source Rasa framework

Comments

@arabellastrange
Copy link

arabellastrange commented Apr 14, 2022

h3. Rasa Open Source version

3.0

h3. Rasa SDK version

3.0

h3. Rasa X version

No response

h3. Python version

3.8

h3. What operating system are you using?

Linux

h3. What happened?

Socket.io channel returns 'unsupported version of protocols' - see error : [!https://user-images.githubusercontent.com/22718292/163340135-3933a9b3-de9a-4a44-931a-5051e01ea61a.png!| https://user-images.githubusercontent.com/22718292/163340135-3933a9b3-de9a-4a44-931a-5051e01ea61a.png] [!https://user-images.githubusercontent.com/22718292/163339967-c1aa270f-feb9-4ebe-8d30-9bbce9616f7a.png!| https://user-images.githubusercontent.com/22718292/163339967-c1aa270f-feb9-4ebe-8d30-9bbce9616f7a.png]

I have tried to connect to my Rasa server via websocket channels on multiple setups, all return this error. The set-ups are detailed here:

[!https://user-images.githubusercontent.com/22718292/163340631-6df6d5f9-d574-4571-987b-131df737aed9.png!| https://user-images.githubusercontent.com/22718292/163340631-6df6d5f9-d574-4571-987b-131df737aed9.png] [!https://user-images.githubusercontent.com/22718292/163340636-f0aa1c22-de72-4c91-aee7-18e790903221.png!| https://user-images.githubusercontent.com/22718292/163340636-f0aa1c22-de72-4c91-aee7-18e790903221.png]

Rasa Version : 3.0.9
Minimum Compatible Version: 3.0.0
Rasa SDK Version : 3.0.6
Rasa X Version : None
Python Version : 3.8.2
Operating System : Windows-10-10.0.22000-SP0

The associated socket.io and sanic package versions are detailed here:

[!https://user-images.githubusercontent.com/22718292/163345213-02b96cc6-794b-4014-b2b1-0cd71f023b07.png!| https://user-images.githubusercontent.com/22718292/163345213-02b96cc6-794b-4014-b2b1-0cd71f023b07.png] [!https://user-images.githubusercontent.com/22718292/163345594-3dc5a3aa-803f-4cbb-bf0c-9b35d5e7bc28.png!| https://user-images.githubusercontent.com/22718292/163345594-3dc5a3aa-803f-4cbb-bf0c-9b35d5e7bc28.png]

[!https://user-images.githubusercontent.com/22718292/163341170-3c225371-246e-4987-b6f3-f46a08faedd0.png!| https://user-images.githubusercontent.com/22718292/163341170-3c225371-246e-4987-b6f3-f46a08faedd0.png] [!https://user-images.githubusercontent.com/22718292/163345686-c32abca8-0ed2-491e-bb16-0cf16d96fc23.png!| https://user-images.githubusercontent.com/22718292/163345686-c32abca8-0ed2-491e-bb16-0cf16d96fc23.png]

sanic 21.12.1
Sanic-Cors 2.0.1
sanic-jwt 1.7.0
sanic-plugin-toolkit 1.2.1
sanic-routing 0.7.2

python-engineio 4.3.1
python-socketio 5.5.2

The advice I have received in the forums is to downgrade to this Sanic setup

sanic==21.6.0
Sanic-Cors==1.0.0
sanic-jwt==1.7.0
sanic-plugin-toolkit==1.2.1
sanic-routing==0.7.0

python-engineio==4.2.1
python-socketio==5.4.0

however, this is not possible because - according to pip - Rasa 3.0 requires a minimum of sanic-routing==0.7.2 which then means sanic==21.6.0 is incompatible.

Due to this, I cannot interface with my chatbot using botfront or the rasa chat widget.

h3. Command / Request

rasa run -m models --enable-api --cors "*" --debug

curl http://localhost:5005/socket.io

h3. Relevant log output

The client is using an unsupported version of the Socket.io or Engine.io protocols.
@arabellastrange arabellastrange added area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. labels Apr 14, 2022
@sara-tagger
Copy link
Collaborator

Thanks for the issue, @kalkbrennerei will get back to you about it soon!

You may find help in the docs and the forum, too 🤗

@ancalita
Copy link
Member

@arabellastrange Thanks for flagging this issue - It's a bit difficult to track which depedency versions you're using with which rasa version from the issue content, I would therefore ask you to create a fresh new virtual environment and install the latest rasa version 3.1, this will install also its required dependencies:

sanic 21.12
python-engineio 4.3.1
python-socketio 5.5.2

Let me know if this set-up fails for you.

@arabellastrange
Copy link
Author

arabellastrange commented Apr 22, 2022

Hello,

Thanks for the reply. I created a fresh venv with rasa 3.1 as requested:
rasav

My entire environment is attached as a txt file here:
requirements.txt

The problem with socket IO persists:
socket2
socket3
socket

@ancalita ancalita added the area:rasa-oss/channels 📞 Issues focused around rasas input and output channels label Apr 25, 2022
@ancalita
Copy link
Member

@arabellastrange I've passed this reported bug to be triaged accordingly, my preliminary findings were:

  • yes I was able to reproduce the issue
  • however when testing with this example repo the chat widget worked
  • I also tested GET /webhooks/socketio and that worked fine.

@ancalita ancalita mentioned this issue Aug 22, 2022
4 tasks
@znat
Copy link
Contributor

znat commented Aug 23, 2022

Hi @arabellastrange, do you encounter the issue when connecting an actual chat widget ?

I tried connecting the rasa chat widget (from the hosted storybook) to a locally running rasa 3.2.5 instance and it worked just fine:

image

But indeed, curl http://localhost:5005/socket.io returns the The client is using an unsupported version of the Socket.io or Engine.io protocols error.

Which, from the python-engineio source code is expected:

        if sid is None and query.get('EIO') != ['4']:
            self._log_error_once(
                'The client is using an unsupported version of the Socket.IO '
                'or Engine.IO protocols', 'bad-version'
            )
            return await self._make_response(self._bad_request(
                'The client is using an unsupported version of the Socket.IO '
                'or Engine.IO protocols'
            ), environ)

Adding the required query param (which is sent by the socketio client) fixes the problem:
> curl http://localhost:5005/socket.io/\?EIO\=4
returns indeed
{"sid":"yWKVn4uSrlmIPi4fAAAJ","upgrades":["websocket"],"pingTimeout":20000,"pingInterval":25000}

I believe this param to be the engineio version the client is expecting to handshake with.

I'll be closing for now, but feel free to re-open is the issue persists when connecting a chat widget using a compatible socketio client (>v3.x)

@mmansoornano
Copy link

mmansoornano commented Sep 19, 2022

I am using the rasa/rasa:3.2.9-full docker image, ran it with following in docker-compose:

command: ["run", "--enable-api", "--cors", "'*'"]

and adding following in credentials.yml:

socketio:
  user_message_evt: user_uttered
  bot_message_evt: bot_uttered
  session_persistence: true

And facing the same issue using:
https://host:5005/socket.io/\?EIO\=4

Receiving following in postman:
"The client is using an unsupported version of the Socket.IO or Engine.IO protocols"

Has anyone resolved the issue?

What are the alternatives with rest api for webchat-tool?
"Keeping in mind the docker image in production."

Is there any Docker Image for webchat-tool that we can use with rest-api-webhook?

@exalate-issue-sync exalate-issue-sync bot removed the type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. label Nov 24, 2022
@exalate-issue-sync
Copy link

Nathan Zylbersztejn commented: I first got trapped into looking into conflicting dependencies, then I simply tried connecting the rasa chat widget (from the [hosted storybook|https://chat-widget-docs.rasa.com/?path=/docs/rasa-chat-widget--widget&globals=backgrounds.grid:false]) to a locally running rasa 3.2.5 instance. It works just fine:

!image-20220823-090652.png|width=1388,height=721!

But indeed, {{curl http://localhost:5005/socket.io}} returns the The client is using an unsupported version of the Socket.io or Engine.io protocols error.

Which, from the [python-engineio repo|https://github.com/miguelgrinberg/python-engineio/blob/d3a23c0936cda2ff3de8c5ae0c834ffef515e8cb/src/engineio/asyncio_server.py#L228] is expected:

!image-20220823-091009.png|width=528,height=185!

Adding the required query param fixes the problem:
{{> curl http://localhost:5005/socket.io/\?EIO\=4}}
returns indeed
{{{"sid":"yWKVn4uSrlmIPi4fAAAJ","upgrades":["websocket"],"pingTimeout":20000,"pingInterval":25000}}}

Notice the GH user didn’t mention having issue with a chat widget 🙃

[~accountid:61dbef588534980073f91c40] , shall I just reply and close the issue?

@exalate-issue-sync
Copy link

Anca Lita commented: Thanks for looking into this 🙌 Yes please reply on Github with your findings, this way the community encountering the same issue will understand the potential fix. I would also recommend updating our docs and/logs where applicable with this extra query parameter, do you know what it represents?

@exalate-issue-sync
Copy link

Anca Lita commented: We can also look together which docs or internal logging needs to be updated, I don’t know off the top of my head either.

@exalate-issue-sync
Copy link

Nathan Zylbersztejn commented: There was no issue to correct however the doc was updated to emphasize that compatibility between socket io client and server should be verified when implementing the channel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss/channels 📞 Issues focused around rasas input and output channels area:rasa-oss 🎡 Anything related to the open source Rasa framework
Projects
None yet
Development

No branches or pull requests

5 participants