Rasa deploy problem,chrome give the log “Provisional headers are shown”

Hey there!

I have test my project locally and the bot is able to give the right answer through the api(not the socket way).

However,when I try to deploy the front project, chrome shows “Provisional headers are shown”,and the status_code=200.

After a long time of google,I found that maybe the problem happens because of “cors” thing.

And I think I need some help for this situation now ,thanks!

I have been troubled for several days. >.<

credentials.yml

socketio:

user_message_evt: user_uttered

bot_message_evt: bot_uttered

session_persistence: true

index.html

<script>
    WebChat.default.init({
        selector: "#webchat",
        initPayload: "/get_started",
        interval: 1000, // 1000 ms between each message
        customData: {"language": "en"},
        socketUrl: "http://localhost:5005",
        socketPath: "/socket.io/",
        title: "bot",
        subtitle: "",
        profileAvatar: "robotic.png",
        showCloseButton: true,
        fullScreenMode: false
    })
</script>

hey @CaptXiong, did you tried running the rasa server using the below command:

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

Thank you for replying!

I used to run the project in docker-compose just as the tutorial says:

version: '3.0'
services:
  rasa:
    image: rasa/rasa:1.10.3-full
    ports:
      - 5005:5005
    volumes:
      - ./:/app
    command:
      - run

Then I tried your way in terminal to start my project, I found this way make the bot has a different api url.

Now I cant’t get any answer by this way:

headers = {‘Content-Type’: ‘application/json’}

data = {“sender”: “test”, “message”: “hello?”}

try:
    res = requests.post(
        'http://localhost:5005/webhooks/rest/webhook',
        json=data, headers=headers)

On the other hand,though the bot in chrome didn’t give me any answer, the chome console seems like more close to a right one.

Request URL:

http://localhost:5005/socket.io/?EIO=3&transport=polling&t=NCTB9MN&sid=3ac31e92ba634dc7894d0dd51e7d7307

If I wanna to start rasa in your way in docker-compose,then what should command be? (because if I copy the command in docker-compose , there would be an error)

Hey!Thank you very much!

I changed another front project of html and use your command,it works!

And I still wanna know that how the command should be in docker-compose. :joy:

hey @CaptXiong, for running the same command in docker-compose, you can add the below command in you Dockerfile:

If you are using official rasa docker image:

CMD [ “run”,“-m”,“/app/models”,“–enable-api”,“–cors”,“*”,“–debug” ]

Also you can check my repo for the reference:

https://github.com/JiteshGaikwad/Rasa_Deployment/blob/master/backend/Dockerfile

thank you!

I found that in docker-compose it can work like:

command:

  - run
  - --enable-api
  - --cors
  - "*"
  - --debug