1
votes

Rasa core version 13.7 nlu version 14.6 os windows 10 python version 3.5

i created rasa chatbot and trained nlu as well as dialogue model.i have manage to run this bot successfully in the console but when we try to run this as the http server we get a cors proxy error as follows the command we used to run the server is

  • python -m rasa_core.run -d models/dialogue -u models/nlu/default/stem_nlu --enable_api --credentials credentials.yml --cors "*" i have also tried
  • python -m rasa_core.run -d models/dialogue -u models/nlu/default/stem_nlu --enable_api --credentials credentials.yml --cors "*" -c rest with no luck

    i have also tried

    • python -m rasa_core.run -d models/dialogue -u models/nlu/default/stem_nlu --enable_api --credentials credentials.yml --cors "*" -c rest with no luck i tried sending request through browser and postman to

      localhost:5005/conversations/deafult/respond i got { "code": 400, "details": { "in": "query", "parameter": "query" }, "help": null, "message": "Missing the message parameter.", "reason": "InvalidParameter", "status": "failure", "version": "0.13.7" }

and also tried

       localhost:5005/webhooks/rest/webhook 

i got

     Bad Request
     The browser (or proxy) sent a request that this server could not understand.

bot server shows

       options 127.0.0.1 - - [2019-04-15 17:34:30] "OPTIONS /webhooks/rest/webhook HTTP/1.1" 200 306 0.001031

then post request

     127.0.0.1 - - [2019-04-15 17:34:30] "POST /webhooks/rest/webhook 
  HTTP/1.1" 400 352 0.000000

and we have used script as follows $(document).ready(function(){

$("#button").click(function(){
var message=document.getElementById("message").value;
 console.log(message);
$.ajaxSetup({
 headers: {"Content-Type": "application/json"}
 });

$.ajax({
 url: "http://localhost:5005/webhooks/rest/webhook",
 type: "POST",
 data: '{ "sender": message}'
 }).done(function(data) {

    console.log(data);
 })
1

1 Answers

1
votes

Explicitly mention that CORS needs to accept all API calls. Go to the RASA project folder and run the following:

rasa run --enable-api --cors "*"

Now you will not see cors error.