Socket.io issues for rasa 2.3 or higher version

Hi everyone , I’m not able to get the bot widget on the server because of the socket.io issues and I keep getting this error - index.js:123 GET http://localhost:5005/socket.io/?EIO=3&transport=polling&t=NilV9Fx 500 (Internal Server Error)

I’m using this code to show my bot on server -

Currently I’m using rasa-2.8 version. Any help/support regarding this will be appreciated.

Heya @Anchal!

If you can tell which chatbot widget you are using for your project and where your bot is deployed or on which server?

Hey Nik I haven’t deployed the bot yet,it is running on the localhost and I’m talking about the chat-widget that we get in the very start of a bot.

@Anchal your chatbot widget name, which one you using?

rasa-webchat

@Anchal Great! So what the issue you getting and what are the steps you are following? and please can you share the error screenshot?

Few suggestions:

  1. Hope you uncommented below snippet code in credentials.yml

     socketio:
       user_message_evt: user_uttered
       bot_message_evt: bot_uttered
       session_persistence: true
    
  2. Hope you are using this snippet code:

     <div id="webchat">
     </div>
     <script src="https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.min.js"></script>
     <link rel="stylesheet" type="text/css" href="https://">
      <script>!(function () {
        let e = document.createElement("script"),
          t = document.head || document.getElementsByTagName("head")[0];
         (e.src =
          "https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.1/lib/index.js"),
           (e.async = !0),
           (e.onload = () => {
             window.WebChat.default(
              { 
                 selector: "#webchat",
                initPayload: "/get_started",
          customData: {"language": "en"}, // arbitrary custom data. Stay minimal as this will be added to  the socket
           socketUrl: "http://localhost:5005",
           socketPath: "/socket.io/",
           title: "Rasa Bot",
           tooltipPayload: "/get_started",
           tooltip: true,    
           tooltipDelay: 500,
           subtitle: "Powered by XYZ",
           connectingText: "Waiting for server...",
           profileAvatar: "https://",
           openLauncherImage: "https://",
    
           params: {"storage": "session"}, 
      
          mainColor: "#ffd600",
          userBackgroundColor: "#ffd600",
          userTextColor: "#cde9ce",
          showMessageDate: false,
          inputTextFieldHint: "Hi.Type your message here...",
          badge: " ",
          displayUnreadCount: true,
          isChatOpen: false,
          embedded: false,
          showCloseButton: true,
          fullScreenMode: true,
          showFullScreenButton: true,
          docViewer: false,
          },
           null
        );
       }),
       t.insertBefore(e, t.firstChild);
      })();
     </script>
    

I hope you using index.html or directly in Wordpress site header and footer body section plug in.

Please ignore some of the field shown in the snippet code, used what best for your use case.

Please Note: :warning: Version 1.0.1 of the rasa webchat is made to work with version 2.3.x and 2.4.x of rasa or latest. Use 1.0.0 for other rasa versions.

Try run first on localhost, if you able to run on localhost, then later I will guide you how you can deploy server.

Good luck!

Hey Nik , Thankyou so much for your help ,it really worked out. I was missing a few things in index.html file but now its working fine on localhost. Let me know how can we deploy it on a real time tool.

@Anchal Great! Please can I request to close this thread with the solution for others?

sure

@nik202 I am also getting the same issue on HTTPS, used your code mentioned above still getting same error. can you have a look at my question please?

@Anchal Can, I request you Anchal to please close this thread with the solution for others. Thanks.

Hi, I am still getting the 500 error, I am using the same code and using RASA 2.3.8

You need to use webserver and real domain names to use it for real. Are you familiar how to do those?

What is your system architecture? Is it working in HTTP?

Update to 2.8.x

@abhilash1 share the snippet code which you are using?

@nik202 I tried same code snippet which is mentioned in this thread. its not working. Also earlier used following which was working earlier:-

<html>
<head>
<title>ChatBot</title>
<link rel="stylesheet" href="https://npm-scalableminds.s3.eu-central-1.amazonaws.com/@scalableminds/chatroom@master/dist/Chatroom.css" />
</head>
<body>
<div class="chat-container"></div>

<script src="https://npm-scalableminds.s3.eu-central-1.amazonaws.com/@scalableminds/chatroom@master/dist/Chatroom.js"/></script>
<script type="text/javascript">
var chatroom = new window.Chatroom({
host: "http://localhost:5005",
title: "Chat with CDA bot",
container: document.querySelector(".chat-container"),
welcomeMessage: "Hi, How may I help you?",
speechRecognition: "en-US",
voiceLang: "en-US"
});
chatroom.openChat();
</script>
</body>
</html>

this was also working fine earlier:-

<html>
<div id="rasa-chat-widget" data-websocket-url="http://localhost:5005/"></div>
<script src="https://unpkg.com/@rasahq/rasa-chat" type="application/javascript"></script>
</html>

@abhilash1 check this link: Rasa chatbot website integration | Quick tutorial - YouTube you will able to integrate, can you even share rasa --version screenshot.

rasa --version
2021-11-09 17:12:23.662554: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /grid/sfi/farm/nflsf01//10.1/linux3.10-glibc2.17-x86_64/lib
2021-11-09 17:12:23.662975: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Rasa Version     : 2.3.4
Rasa SDK Version : 2.4.0
Rasa X Version   : 0.37.1
Python Version   : 3.7.9
Operating System : Linux-3.10.0-514.el7.x86_64-x86_64-with-redhat-7.3-Maipo
Python Path      : /lan/ops/cdnshelp/cops/users/pubtools/chatbot/Python-3.7.9/bin/python3.7

@abhilash1 you can use rasa Webchat, but you need to mention 1.0.0 or 1.0.1 (I am not sure, since ages not changed my version) in version, but I would highly recommend to upgrade the rasa at least to 2.8.1. Good Luck!