Chatroom in Docker doesn't response

Hi, I can run rasa shell in rasa/rasa with rasa/rasa-sdk, but when I’m trying to add chatroom into rasa/rasa, there is no response from docker logs or ‘yarn serve’ screen, just 2 error on chrome console as below:

POST http://localhost:5005/webhooks/rest/webhook net::ERR_CONNECTION_REFUSED  Chatroom.js:1307 

Uncaught (in promise) TypeError: Failed to fetch  Chatroom.js:1307 

it’s strange that I can get response with ‘curl -X POST -d ‘{“message”:“hi”}’ http://localhost:5005/webhooks/rest/webhook’ in docker.

Here is my docker-compose.yml:

version: '3.0'
services:
  rasa:
    image: rasa/rasa:vmreq
    ports:
      - 28000:8080
    volumes:
      - /chatbot/vmreq/rasa:/app
      - /chatbot/vmreq/chatroom:/chatroom
    command:
      run
      --enable-api
      --cors "*"
      --endpoints endpoints.yml
    networks:
      - vmreq
    links:
      - vmaction
    
  vmaction:
    image: rasa/rasa-sdk:vmreq
    expose:
      - "5055"
    volumes:
      - /chatbot/vmreq/rasa/actions:/app/actions
    networks:
      - vmreq
networks:
  vmreq:
    external: true

since the browser gets an error fetching Chatroom.js, are you able to retrieve that file with curl or wget ?

hi Alan, everything is working good with curl and wget

Fixed and share to anyone who need it in case: 5005 should be exposed to [host’s port]. Host configuration in index.html of Chatroom should point to http://hostip:[host’s port], not localhost:5005 even they are in the same container. You can check docker-compose.yml and index.html as below:

docker-compose.yml

version: '3.0'
services:
  rasa:
    image: rasa/rasa:vmreq
    ports:
      - 28000:8080
      - 25005:5005
    volumes:
      - /chatbot/vmreq/rasa:/app
      - /chatbot/vmreq:/local
      - /chatbot/vmreq/chatroom:/chatroom
    entrypoint: /local/docker-entrypoint.sh
    networks:
      - vmreq
networks:
  vmreq:
    external: true

index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" type="text/css" href="./dist/Chatroom.css">
    <link rel="stylesheet" type="text/css" href="./index.css">
    <title>BIT Platform Chatroom</title>
  </head>
  <body>
    <div class="chat-container"></div>
    <script src="./dist/Chatroom.js"></script>
    <script type="text/javascript">
window.chatroom = new window.Chatroom({
  title: "Chat with Bot",
  container: document.querySelector(".chat-container"),
  welcomeMessage: "Hi.",
  //host: "http://localhost:5005",
  host: "http://xxx.xxx.xxx.xxx:25005",
  speechRecognition: "en-US",
});
window.chatroom.openChat();
</script>
  </body>
</html>