I am having a chatbot powered by Rasa which runs fine independently. When the bot is integrated (via rest channel) with my own website created via flask works fine too - but all this when run locally.
Now I wanted to deploy the website to cloud so that the bot could be used/accessed by others too. I am able to deploy the website/app to GCP successfully but connecting to the bot is where is problem arises.
I am under the assumption that to work the rasa bot should also be present in cloud (might be wrong too and there could be some other way to achieve this), but most of the articles that have covered the scenario have used docker for deployment and I am currently stuck in that.
Using rasa (1.3.9) & rasa-sdk (1.3.3) and OS - Windows 10 Home
Thanks in advance.
Where is the code for the bot currently running? Is that on your local machine, or did you migrate the bot service to GCP as well?
If the bot is running on your local machine, but your website - which tries to connect to your bot - is in GCP then you are going to have problems connecting. Ideally the bot should be present in the cloud, but this is not the only way of getting this done. If it is only running locally then you can tunnel your local port to a web-accessible location. I’ve done this in the past for testing purposes, and it does work, but I wouldn’t recommend it for a production bot, not least because you might then be violating your ISP’s terms-of-service and be leaving your local machine open to everyone on the internet who wants to come your way.
I’ll see if I can dig up some links in a while.
Edited to add: Well, in the past I’ve used a reverse ssh tunnel to do this with a service called serveo.net. Just tried to connect to them and they seem to be having an issue with their certificate, so that’s not really an option at the moment. Other possibilities are ngrok, or just doing a reverse ssh tunnel to the GCP machine that’s running your website.
Thank you @netcarver for the quick reply.
Currently my bot is in local machine, I looked up on how to migrate it to GCP and got few suggestions on using Docker (surely there should be other ways too) where I am stuck at as Docker doesn’t support Windows 10 Home which I am using.
I had already tried what you had suggested - making my local port to web-accessible and used ngrok but having some issues with that.
Steps I had taken-
kicked off rasa action server on default port 5055
used ngrok and received forwarding url to make localhost:5055 accessible to internet
started rasa bot by having the forwarding url in endpoints.yml as action_endpoint
accessed website and tried the chatbot
Error - “Blocked loading mixed active content” (firefox) & “Mixed Content: The page at ‘https://XXXXXXXX.appspot.com/chatbot’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://XXXXXXX.ngrok.io/webhooks/rest/webhook’. This request has been blocked; the content must be served over HTTPS” (chrome)
So when switch to http I get “Access to XMLHttpRequest at ‘http://XXXXXXX.ngrok.io/webhooks/rest/webhook’ from origin ‘http://XXXXX.appspot.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource” (chrome). I have used “CORS” option (ommand used - rasa run -m models --enable-api --cors “*” --debug --credentials credentials.yml --endpoints endpoints.yml) while starting the rasa bot
I will go through the suggested reading links and see if something happens.
Ah, sounds like you have the same problem as posted here.
I’m not sure that Cross Origin headers are going to solve this for you - they didn’t in my testing. As I posted over in the other reply, I got around the browser’s mixed content objections by running an nginx reverse proxy which listens on a port with https enabled and forwards connections to the bot. I used the bitnami/nginx docker image for this (As a side note, I also have this nginx container serve assets like images/js/css for the bot itself.)
There will be something in the first link I sent you about nginx proxying with ssl, failing that, there are lots of online configs on google and walkthroughs on youtube. Look at several and consider how this can work in to your architecture.
As I said in the other thread, there may be other ways to solve this issue, but using nginx as a https <-> http proxy for the bot is the only way I have done it.