Rasa with ngrok show error xhr poll error connection refused

hellooo everyone,

So, i have create a chatbot with rasa and i use socket io for my web page. I want to test it with other people, so i came across with ngrok. I follow all the steps and finally it works on my machine perfectly! In details, i use the ngrok url, something like : https://xxxx.xxxxxxx.ngrok.io on my machine and works fine. But when i share this link in other people, they only see the index hml with the correct css but the chatbot icon doesn;t show. And they get a message " xhr poll error connection refused" :262671236_635667740943158_4951668160411221412_n Do you have any idea ?? Thank you in advance :slight_smile:

Hi @DimitraK,

Not sure how you call in index.js the rasa API, but I guess you have to change the URL with localhost references to the new ngrok URL and no 5005 port if ngrok is listening on port 443.

@DimitraK can you share the rasa --version and what is your frontend ? So, that I can help you in right direction?

hello again, i’m using on front end a webchat library from this link “https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.1/lib/index.js

window.WebChat.default( { … socketUrl: “http://localhost:5005”, socketPath: “/socket.io/”, … the version of rasa and etc : Rasa Version : 2.8.2 Minimum Compatible Version: 2.8.0 Rasa SDK Version : 2.8.1 Python Version : 3.8.11

I write my steps for more details: i’m running action server on 5055 port, rasa on 5005 with rasa run --m ./models --endpoints endpoints.yml --port 5005 -vv --enable-api --cors “*” and python -m http.server Serving HTTP on :: port 8000 (http://[::]:8000/) In this way i connect ngrok with 8000 (ngrok http 8000).

Also python-engineio 3.14 socket io 4.6.1

Thank you in advance! DK

@DimitraK and why you exposing the port 8000 with ngrok is this your rasa server?

Just run the Rasa server using ngrok i.e ngrok http 5005, paste the generated link in socketUrl

Update this:

python-engineio==4.2.1
python-socketio==5.4.0
sanic==20.9.0
Sanic-Cors==0.10.0

Good Luck!

First, thank you for your time! So i will explain my steps, because i think that i’m missing something important…

  • I’m running my action server on port 5055 endpoint file is like: action_endpoint: url: http://localhost:5055/webhook

  • Next steps is to run my rasa server on 5005 port like this: rasa run --m ./models --endpoints endpoints.yml --port 5005 -vv --enable-api --cors “*”

  • Then i get the ngrok url (for 5005 port), and paste it in index.html like this:
    socketUrl: “https://xxx.xxxxxxx.ngrok.io”, but when i ran on my browser, the ngrok url (https://xxx.xxxxxxx.ngrok.io), i get a message from server i guess “Hello from Rasa: 2.8.2”. Please let me tell you that i want to use ngrok to expose my web chat to other users in order to test it. So in my mind i was thinking that i should expose port of web chat, not the posrt of rasa server… :confused: i Could please help me to understand…

Thanks again !!!

Kind regards DK

@DimitraK Right, are you using any website or just a localhost for index.html check the port of local host first, then in sockelUrl: just mention localhost 5005 and then run ngrok for localhost with port.

On the other hand if you have running website then scenario will be different.

Hmm… i try this way but i get the same error as my first message. :confused:

So i have a page index.html that runs on localhost and for example at port 5051, i get the ngrok url for 5051 port and finally it runs perfect on my computer. But when i share this link with others, they can see the index html but there is no chatbot icon and they get error like http://localhost:PORT THAT RUNS RASA SERVER… net:ERR_CONNECTION_REFUSED xhr poll error. Any suggestions??! p.s. i run rasa with this command

  • rasa run --m ./models --endpoints endpoints.yml --port 5005 -vv --enable-api --cors “*”

Thanks again DK

@DimitraK I not get it where is your error.

I use this command only

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

Its hard to tell now for me. if you can set the call?

Always mention @ and nik202

@nik202 I found a solution for my issue but i would like to thank you again!!! :slight_smile: DK

@DimitraK wow, please share with us or please close this thread if the above suggestions helped you to solve your issue :slight_smile:

The solution for my issue :

  1. i use one ngrok command for rasa server (ex port 5005)
  2. second for port where the site was running (ex port 5051)

:slight_smile:

@DimitraK This suggestion I have mentioned in my this thread Rasa with ngrok show error xhr poll error connection refused - #8 by nik202 may be you mis understood :slight_smile: Even, said the website scenario will be different as you also hosting the website on port 5051. Great you finally managed and thanks for the feedback Dimi. Good Luck!