Official rasa chat widget - socket.io connection refused

Hi, I am totally new to Rasa and trying to use the Rasa Chat widget described here

I get this error http://localhost/socket.io/?EIO=4&transport=polling&t=NttRrl2 net::ERR_CONNECTION_REFUSED

My credentials has: c1

My index.html has: c2

Hi @rafa21 and welcome to the forum :slight_smile:

No worries will solve this together. Please can you share your rasa --version.

@rafa21 can you please update this “http://localhost:5005

@rafa21 are you using rasa open-source or rasa x? It local installation or server-side?

@rafa21 which command you are using to run the rasa?

Dear @nik202 Thank you so much for your help

Rasa Version : 3.0.3 Minimum Compatible Version: 3.0.0 Rasa SDK Version : 3.0.2 Rasa X Version : None Python Version : 3.8.8 Operating System : macOS-10.14.6-x86_64-i386-64bit

I am running rasa as:

rasa run -m models --enable-api --cors “*”

And using Flask for the web.

I had tried changing port and I get: rasa-chat:2 GET http://localhost:5005/socket.io/?EIO=4&transport=polling&t=NtyrcHo 500 (Internal Server Error)

And on the rasa console I now get:

2021-12-27 14:04:19 INFO root - Starting Rasa server on http://0.0.0.0:5005 2021-12-27 14:04:23 INFO rasa.core.processor - Loading model models/20211225-183322-fundamental-skate.tar.gz… 2021-12-27 14:04:41 WARNING rasa.shared.utils.common - The UnexpecTED Intent Policy is currently experimental and might change or be removed in the future :microscope: Please share your feedback on it in the forum (http://forum.rasa.com) to help us make this feature ready for production. 2021-12-27 14:04:49 INFO root - Rasa server is up and running. The WebSocket transport is not available, you must install a WebSocket server that is compatible with your async mode to enable it. See the documentation for details. (further occurrences of this error will be logged with level INFO) [2021-12-27 14:04:50 -0300] [48212] [ERROR] Exception occurred while handling uri: ‘http://localhost:5005/socket.io/?EIO=4&transport=polling&t=NtysXFC’ Traceback (most recent call last): File “handle_request”, line 83, in handle_request class Sanic(BaseSanic, metaclass=TouchUpMeta): File “/Users/rafa/opt/anaconda3/envs/installingrasa/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 308, in handle_request return await self._make_response(r, environ) File “/Users/rafa/opt/anaconda3/envs/installingrasa/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 376, in _make_response response = make_response( File “/Users/rafa/opt/anaconda3/envs/installingrasa/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 [2021-12-27 14:04:55 -0300] [48212] [ERROR] Exception occurred while handling uri: ‘http://localhost:5005/socket.io/?EIO=4&transport=polling&t=NtysYcD’ Traceback (most recent call last): File “handle_request”, line 83, in handle_request class Sanic(BaseSanic, metaclass=TouchUpMeta): File “/Users/rafa/opt/anaconda3/envs/installingrasa/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 308, in handle_request return await self._make_response(r, environ) File “/Users/rafa/opt/anaconda3/envs/installingrasa/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 376, in _make_response response = make_response( File “/Users/rafa/opt/anaconda3/envs/installingrasa/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 [2021-12-27 14:05:01 -0300] [48212] [ERROR] Exception occurred while handling uri: ‘http://localhost:5005/socket.io/?EIO=4&transport=polling&t=Ntysa2L’ Traceback (most recent call last): File “handle_request”, line 83, in handle_request class Sanic(BaseSanic, metaclass=TouchUpMeta): File “/Users/rafa/opt/anaconda3/envs/installingrasa/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 308, in handle_request return await self._make_response(r, environ) File “/Users/rafa/opt/anaconda3/envs/installingrasa/lib/python3.8/site-packages/engineio/asyncio_server.py”, line 376, in _make_response response = make_response( File “/Users/rafa/opt/anaconda3/envs/installingrasa/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

@nik202 I wonder if the problem is my flask code:

from flask import Flask, render_template, request, jsonify
import os,sys,requests, json
from random import randint
app = Flask(__name__)
@app.route('/')
def home():
  return render_template('index.html')

@app.route('/parse',methods=['POST', 'GET'] )
def extract():
  text=str(request.form.get('value1'))
  payload = json.dumps({"sender": "Rasa","message": text})
  headers = {'Content-type': 'application/json', 'Accept':     'text/plain'}
  response = requests.request("POST",   url="http://localhost:5005/webhooks/rest/webhook", headers=headers, data=payload)
  response=response.json()
  resp=[]
  for i in range(len(response)):
    try:
      resp.append(response[i]['text'])
    except:
      continue
  result=resp
  return render_template('index.html', result=result,text=text)
if __name__ == "__main__":
  app.run(debug=True)

@rafa21 No this is not related to flask this is much related to socketIO and Sanic version issue.

Can you please see this thread Rasa 3.0 error socket.io - #13 by nik202 and try update the versions for the mention packages, please take care of all the dependencies issue (red color) some can be rasa-sdk and some can be sanic.

@rafa21 If you still face some issue please let me know please.

Trick Suggested to check your code:

If you think that you have some issue with flask, you can create the new rasa environment and try install rasa and rasa-sdk to 2.8.1 respectively and then try run the rasa and flask. You will get the clear result. [please don’t perform this suggestion in current working environment for that please follow the above mention thread and suggestion] Thanks.

I wish this will solve your issue as earliest.

Dear @nik202 I tried following your instructions and update all the list according to requirements, but according to pi some are incompatible. I added it in your other thread:

I tried doing

pip uninstall rasa
pip install rasa==3.0.2

but I stll get

 Rafaels-MacBook-Air:sample-web-wa rafa$ rasa --version
Rasa Version      :         3.0.3
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.0.2
Rasa X Version    :         None
Python Version    :         3.8.8

Hi @nik202 I uninstalled all the packages and installed them with the depraceted option so it does not check versions and it worked

thank you! rafa

@rafa21 Great Rafal :+1: Can you share the rasa current version and all related packages with version for the other readers.

Please can you update the topic category to rasa open source from Getting started with rasa.

Thanks. Nik

Hi @nik202

Thanks for your help To go down the Rasa version I had to uninstall the one I had, and all the sanic libraries, then reinstall with the --use-deprecated=legacy-resolver option

Now that it works, I am now using:

Rasa Version      :         3.0.2
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.0.2
Rasa X Version    :         None
Python Version    :         3.8.8
sanic                   21.6.0
Sanic-Cors              1.0.0
sanic-jwt               1.7.0
sanic-plugin-toolkit    1.2.0
Sanic-Plugins-Framework 0.9.5
sanic-routing           0.7.0

@rafa21 Thanks for the feedback. I request you to please close this thread as a solution for others and for your reference and good luck!