botfront / rasa-webchat

A feature-rich chat widget for Rasa and Botfront
https://botfront.io/rasa
Apache License 2.0
951 stars 496 forks source link

socket.io giving server error #372

Closed vaibhavkrishna-bhosle closed 3 years ago

vaibhavkrishna-bhosle commented 3 years ago

I tried to connect my rasa chatbot to the socketio but not able to see UI. the browser console gives a server error message.

Error: server error onPacket https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 setTransport https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onPacket https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:12 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 doPoll https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onLoad https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onreadystatechange https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 create https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 f https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 request https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 doPoll https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 poll https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 doOpen https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 open https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:12 open https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 u https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 exports https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 open https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 n https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 setTimeout handlerreconnect https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 n https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 i https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onError https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onPacket https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 setTransport https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onPacket https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:12 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 doPoll https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onLoad https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onreadystatechange https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 create https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 f https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 request https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 doPoll https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 poll https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 doOpen https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 open https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:12 open https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 u https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 exports https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 open https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 n https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 setTimeout handlerreconnect https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 n https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 i https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onError https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onPacket https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 setTransport https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onPacket https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:12 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:17 doPoll https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 emit https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:1 onData https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onLoad https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 onreadystatechange https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 create https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js:116 index.js:123:155710

this is my HTML code:

<html>
    <head>
    <meta charset="UTF-8">
    <title>Hello World</title>
    </head>
        <body>
          <script>!(function () {
            let e = document.createElement("script"),
              t = document.head || document.getElementsByTagName("head")[0];
            (e.src =
              "https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js"),
              (e.async = !0),
              (e.onload = () => {
                window.WebChat.default(
                  {
                    customData: { language: "en" },
                    socketUrl: "http://localhost:5005",
                    // add other props here
                  },
                  null
                );
              }),
              t.insertBefore(e, t.firstChild);
          })();
          </script>

        </body>
</html>

this is my rasa debug log.

(rasa-2-1-2) vaibhavkrishnabhosle@Vaibhavkrishnas-MacBook-Air Rasa-Init % rasa run -m models --cors "*" --enable-api --debug

2021-04-17 23:20:54 DEBUG rasa.cli.utils - Parameter 'endpoints' not set. Using default location 'endpoints.yml' instead. 2021-04-17 23:20:54 DEBUG rasa.cli.utils - Parameter 'credentials' not set. Using default location 'credentials.yml' instead. 2021-04-17 23:20:54 DEBUG rasa.core.utils - Available web server routes: /conversations//messages POST add_message /conversations//tracker/events POST append_events /webhooks/rasa GET custom_webhook_RasaChatInput.health /webhooks/rasa/webhook POST custom_webhook_RasaChatInput.receive /webhooks/rest GET custom_webhook_RestInput.health /webhooks/rest/webhook POST custom_webhook_RestInput.receive /model/test/intents POST evaluate_intents /model/test/stories POST evaluate_stories /conversations//execute POST execute_action /domain GET get_domain /socket.io POST handle_request / GET hello /model PUT load_model /model/parse POST parse /conversations//predict POST predict /conversations//tracker/events PUT replace_events /conversations//story GET retrieve_story /conversations//tracker GET retrieve_tracker /webhooks/socketio GET socketio_webhook.health /status GET status /model/predict POST tracker_predict /model/train POST train /conversations//trigger_intent POST trigger_intent /model DELETE unload_model /version GET version 2021-04-17 23:20:54 INFO root - Starting Rasa server on http://localhost:5005 2021-04-17 23:20:54 DEBUG rasa.core.utils - Using the default number of Sanic workers (1). 2021-04-17 23:20:54 INFO rasa.model - Loading model models/20210417-231732.tar.gz... 2021-04-17 23:20:55 DEBUG rasa.model - Extracted model to '/var/folders/m6/w2168dkd7n76xlwv8nl_j_1r0000gn/T/tmpenea666n'. 2021-04-17 23:20:56 INFO root - Enabling coroutine debugging. Loop id 140656687591456. 2021-04-17 23:20:56 INFO rasa.model - Loading model models/20210417-231732.tar.gz... 2021-04-17 23:20:56 DEBUG rasa.model - Extracted model to '/var/folders/m6/w2168dkd7n76xlwv8nl_j_1r0000gn/T/tmplua3f2u9'. 2021-04-17 23:20:57 DEBUG rasa.utils.tensorflow.models - Loading the model ... 2021-04-17 23:20:57 DEBUG rasa.nlu.classifiers.diet_classifier - Following metrics will be logged during training: 2021-04-17 23:20:57 DEBUG rasa.nlu.classifiers.diet_classifier - t_loss (total loss) 2021-04-17 23:20:57 DEBUG rasa.nlu.classifiers.diet_classifier - i_acc (intent acc) 2021-04-17 23:20:57 DEBUG rasa.nlu.classifiers.diet_classifier - i_loss (intent loss) 2021-04-17 23:20:57 DEBUG rasa.utils.tensorflow.models - Finished loading the model. 2021-04-17 23:20:57 DEBUG rasa.utils.tensorflow.models - Building tensorflow prediction graph... 2021-04-17 23:21:02 DEBUG rasa.utils.tensorflow.models - Finished building tensorflow prediction graph. 2021-04-17 23:21:02 DEBUG rasa.nlu.classifiers.diet_classifier - Failed to load model for 'ResponseSelector'. Maybe you did not provide enough training data and no model was trained or the path '/var/folders/m6/w2168dkd7n76xlwv8nl_j_1r0000gn/T/tmplua3f2u9/nlu' doesn't exist? 2021-04-17 23:21:02 DEBUG rasa.core.tracker_store - Connected to InMemoryTrackerStore. 2021-04-17 23:21:02 DEBUG rasa.core.lock_store - Connected to lock store 'InMemoryLockStore'. 2021-04-17 23:21:02 DEBUG rasa.model - Extracted model to '/var/folders/m6/w2168dkd7n76xlwv8nl_j_1r0000gn/T/tmp08ndkmjr'. 2021-04-17 23:21:02 DEBUG rasa.utils.tensorflow.models - Loading the model ... 2021-04-17 23:21:03 DEBUG rasa.utils.tensorflow.models - Finished loading the model. 2021-04-17 23:21:03 DEBUG rasa.utils.tensorflow.models - Building tensorflow prediction graph... 2021-04-17 23:21:04 DEBUG rasa.utils.tensorflow.models - Finished building tensorflow prediction graph. 2021-04-17 23:21:04 DEBUG rasa.core.nlg.generator - Instantiated NLG to 'TemplatedNaturalLanguageGenerator'. 2021-04-17 23:21:04 INFO root - Rasa server is up and running. 2021-04-17 23:24:53 DEBUG rasa.core.channels.socketio - User 1dcba9d296924150b473f623c7f13479 connected to socketIO endpoint. 2021-04-17 23:24:54 DEBUG rasa.core.channels.socketio - User d5eb5201e9c748229918ebf71b46d862 connected to socketIO endpoint. 2021-04-17 23:24:56 DEBUG rasa.core.channels.socketio - User 9ff6ac6836f54eb7b1ee877ebcbb81d5 connected to socketIO endpoint. 2021-04-17 23:24:58 DEBUG rasa.core.channels.socketio - User 902188304aab4655a6731850681ddd02 connected to socketIO endpoint. 2021-04-17 23:25:03 DEBUG rasa.core.channels.socketio - User 4505b34d095d4b0480591711d4dda1f8 connected to socketIO endpoint. 2021-04-17 23:25:08 DEBUG rasa.core.channels.socketio - User cdf2ec0c5c89494ba2744425c3baea3c connected to socketIO endpoint. 2021-04-17 23:25:14 DEBUG rasa.core.channels.socketio - User fc90db69944a48868a379ae20b45a783 connected to socketIO endpoint. 2021-04-17 23:25:20 DEBUG rasa.core.channels.socketio - User 5ca2b8bc58ea464db79aa3ca4d83f28c connected to socketIO endpoint. 2021-04-17 23:25:25 DEBUG rasa.core.channels.socketio - User dc5271f7869c41719eeece8e5364e0b2 connected to socketIO endpoint. 2021-04-17 23:25:31 DEBUG rasa.core.channels.socketio - User 542f76067987404b87ade5d0e37f5b3d connected to socketIO endpoint. 2021-04-17 23:25:36 DEBUG rasa.core.channels.socketio - User 57f1dbf1b0dd40feb5c0700c636c59fb connected to socketIO endpoint. 2021-04-17 23:25:42 DEBUG rasa.core.channels.socketio - User 0f3698df91214611badf5aef2c1dc53e connected to socketIO endpoint. 2021-04-17 23:25:48 DEBUG rasa.core.channels.socketio - User a45e0b36dba540999d517b4a7b53250a connected to socketIO endpoint. 2021-04-17 23:25:53 DEBUG rasa.core.channels.socketio - User 1dcba9d296924150b473f623c7f13479 disconnected from socketIO endpoint. 2021-04-17 23:25:54 DEBUG rasa.core.channels.socketio - User 10aec87566264de2b0d560331f614650 connected to socketIO endpoint. 2021-04-17 23:25:57 DEBUG rasa.core.channels.socketio - User d5eb5201e9c748229918ebf71b46d862 disconnected from socketIO endpoint. 2021-04-17 23:26:00 DEBUG rasa.core.channels.socketio - User 70bb75e244324064b4e2249c77821289 connected to socketIO endpoint. 2021-04-17 23:26:02 DEBUG rasa.core.channels.socketio - User 9ff6ac6836f54eb7b1ee877ebcbb81d5 disconnected from socketIO endpoint. 2021-04-17 23:26:05 DEBUG rasa.core.channels.socketio - User 6dcbb7b270da4ec2a44d3112aada55e0 connected to socketIO endpoint. 2021-04-17 23:26:06 DEBUG rasa.core.channels.socketio - User 902188304aab4655a6731850681ddd02 disconnected from socketIO endpoint.

vaibhavkrishna-bhosle commented 3 years ago

you can pull my repo to understand the problem better:

https://github.com/vaibhavkri/Rasa-Init

this is the version on rasa i am using:

(rasa-2-1-2) vaibhavkrishnabhosle@Vaibhavkrishnas-MacBook-Air Rasa-Init % rasa --version Rasa Version : 2.1.2 Rasa SDK Version : 2.3.1 Rasa X Version : None Python Version : 3.7.5 Operating System : Darwin-20.3.0-x86_64-i386-64bit Python Path : /opt/anaconda3/envs/rasa-2-1-2/bin/python

MatthieuJnon commented 3 years ago

Hi, I added some extra clarification in the readme, check it out #374

vaibhavkrishna-bhosle commented 3 years ago

@MatthieuJnon thanks that helped a lot