Socket io in Rasa Server GCP

Hi everyone!

I have just deployed my RASA chatbot in Google Cloud Platform using App Engine, now I want to make my HTML code available in Socket.io.

It works perfectly locally but in GCP server I get this error about authentication, I don´t know how to solve it. Thanks. (I´m using HTTPS)

image

1 Like

you might need to open up the firewall to accepts sockets.

I tried to do the following command to open the firewall port:

gcloud compute firewall-rules create default-allow-websockets \
    --allow tcp:65080 \
    --target-tags websocket \
    --description "Allow websocket traffic on port 65080"

It doesn´t change anything, still seeing “Unauthorized”.

This is the URL: https://high-apricot-315919.nw.r.appspot.com/socket.io

I think rasa listens on port 5005

did you add to the app.yaml

network:
  session_affinity: true

Sorry, I copied from the stack overflow post but I have used 5005 in my machine.

I also add it to the app.yaml

This is the firewall rule I created: image

And this is what I have in my app.yaml image

seems like the rest channel is working fine when i try the rest endpoint.

likely an issue with socket.io and gcp then

Did you add JWT authentication to your credentials.yml in rasa??

No, I didn´t know that I need to add a JWT authentication in credentials.yml.

Can you explain me how to do it? Thanks for your help

JWT is optional, i was thinking perhaps you have added in the credentials.yml and not passing it in the header hence the unauthorized. But i guess that is not the case.

According to this repo: GitHub - o1lab/socket.io-on-gae: Socket.io on Google App Engine

Note: Secure WebSockets are currently not supported by Managed VMs. WebSockets will only work if you load your page over HTTP (not HTTPS).

But this is from 5 years ago. it is possible that Google App Engine does not fully support websockets API.

hmmm okay. so, should I try to use HTTP instead of HTTPS?.

I don´t know what to do hahaha, I just want to deploy my bot with GCP hahaha

@mariasanzs well i think i shared my app that uses google cloud run instead

https://rasa-bot-api-m3chhft4la-ue.a.run.app/socket.io

it does work for me, but you need to connect from a front-end with the same kind of socket.io client instead. not using the browser but i dont have the unauthorized access. The code is here:

also if you clone this repo: follow this thread