guidone / node-red-contrib-chatbot

Visually build a full featured chat bot for Telegram, Facebook Messenger, Whatsapp and Slack with Node-RED. Almost no coding skills required.
http://red-bot.io
930 stars 188 forks source link

Help with Mission Control #604

Open Iciir opened 1 year ago

Iciir commented 1 year ago

I've tried for the first time to play with the MC and I see so much amazing potential.

However, I think something is wrong.

So, here's what I got:

image

Inside MC:

image

No messages received:

image

But yes?

image

And in the console I see this:

node-red_1  | 13 Feb 12:45:57 - [info] Started modified nodes
node-red_1  | 13 Feb 12:45:57 - [info] 
node-red_1  | 13 Feb 12:45:57 - [info] ------ WebHooks for TELEGRAM----------------
node-red_1  | 13 Feb 12:45:57 - [info] http://localhost:1880/redbot/telegram/test
node-red_1  | 13 Feb 12:45:57 - [info] http://localhost:1880/redbot/telegram
node-red_1  | 13 Feb 12:45:57 - [info] 
node-red_1  | 13 Feb 12:45:57 - [info] SQLite context provider configuration:
node-red_1  | 13 Feb 12:45:57 - [info]   dbPath: /data/mission-control.sqlite
node-red_1  | 13 Feb 12:45:57 - [info]   database: OK
node-red_1  | --- ApolloError: Network error: request to http://0.0.0.0:1880/graphql failed, reason: socket hang up
node-red_1  |     at new ApolloError (/data/node_modules/apollo-client/bundle.umd.js:92:26)
node-red_1  |     at Object.error (/data/node_modules/apollo-client/bundle.umd.js:1330:28)
node-red_1  |     at notifySubscription (/data/node_modules/zen-observable/lib/Observable.js:140:18)
node-red_1  |     at onNotify (/data/node_modules/zen-observable/lib/Observable.js:179:3)
node-red_1  |     at SubscriptionObserver.error (/data/node_modules/zen-observable/lib/Observable.js:240:7)
node-red_1  |     at /data/node_modules/apollo-client/bundle.umd.js:1107:37
node-red_1  |     at Set.forEach ()
node-red_1  |     at Object.error (/data/node_modules/apollo-client/bundle.umd.js:1106:21)
node-red_1  |     at notifySubscription (/data/node_modules/zen-observable/lib/Observable.js:140:18)
node-red_1  |     at onNotify (/data/node_modules/zen-observable/lib/Observable.js:179:3)
node-red_1  |     at SubscriptionObserver.error (/data/node_modules/zen-observable/lib/Observable.js:240:7)
node-red_1  |     at /data/node_modules/apollo-link-http/lib/httpLink.js:87:26
node-red_1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
node-red_1  |   graphQLErrors: [],
node-red_1  |   networkError: FetchError: request to http://0.0.0.0:1880/graphql failed, reason: socket hang up
node-red_1  |       at ClientRequest. (/data/node_modules/node-fetch/lib/index.js:1491:11)
node-red_1  |       at ClientRequest.emit (node:events:513:28)
node-red_1  |       at Socket.socketOnEnd (node:_http_client:505:9)
node-red_1  |       at Socket.emit (node:events:525:35)
node-red_1  |       at endReadableNT (node:internal/streams/readable:1359:12)
node-red_1  |       at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
node-red_1  |     type: 'system',
node-red_1  |     errno: 'ECONNRESET',
node-red_1  |     code: 'ECONNRESET'
node-red_1  |   },
node-red_1  |   extraInfo: undefined
node-red_1  | }
node-red_1  | --------------------- GraphQL Error (id: f4ae4eb9e5c6c267) ---------------------
node-red_1  | (empty array)
node-red_1  | 

Something seems a bit unintended.

guidone commented 1 year ago

Thanks for testing this, I really need some feedback on MC.

Some context: Mission Control can handle multiple chatbots (multiple chatbotID) with the same control panel, that's the reason is asking to select one. It's tries to fetch the list of available chatbots from GraphQL, unfortunately is not bootstrapping for some reason.

Do you have a particular configuration? (i.e., running node-red on a different port, or different root directory, are projects enabled, etc.) Which version of node-red? Can you also post the console.log of the browser? Do you have any browser plugin that could block web socket connections (i.e., if you have uBlock can you try disabling it)?

For sure, it should handle better the error on GraphQL.

Iciir commented 1 year ago

I am running 3 instances of Node-RED through Docker for different purposes.

Ports: 1880 1884 1887

But the one I'm trying MC on is the 1880 one which is the default so it should be fine.

The relevant Console Log things I can find, inside the Node-RED Dashboard:

JQMIGRATE: Migrate is installed, version 3.3.0
Node-RED: 3.0.2
Versions
»  jQuery 3.5.1
»  jQuery UI 1.12.1
»  ACE 1.4.12
»  D3 3.0.3

No relevant errors:

image

Now let's see in the MC Dashboard:

image

A thing I'm noticing here is that it says "production" but I'm running all my bots in development.

Another interesting thing is that I tried to configured settings.js with this:

image

I wrote the paths similar to those which work perfectly:

image

But I just realize now that they're not the same kind of paths, anyway, it completely ignores those MC settings:

node-red_1  | 15 Feb 11:08:03 - [info] Red Bot Mission Control configuration:
node-red_1  | 15 Feb 11:08:03 - [info]   admin root: /
node-red_1  | 15 Feb 11:08:03 - [info]   backend environment: development
node-red_1  | 15 Feb 11:08:03 - [info]   front end environment: production
node-red_1  | 15 Feb 11:08:03 - [info]   salt: default
node-red_1  | 15 Feb 11:08:03 - [info]   dbPath: /data/mission-control.sqlite
node-red_1  | 15 Feb 11:08:03 - [info]   pluginsPath: /data/dist-plugins
node-red_1  | 15 Feb 11:08:03 - [info]   MC root: /mc
node-red_1  | 15 Feb 11:08:03 - [info]   host: localhost
node-red_1  | 15 Feb 11:08:03 - [info]   port: 1880
node-red_1  | 15 Feb 11:08:03 - [info]   OTP: false
node-red_1  | 15 Feb 11:08:08 - [info] Settings file  : /data/settings.js
node-red_1  | 15 Feb 11:08:08 - [info] Context store  : 'default' [module=memory]
node-red_1  | 15 Feb 11:08:08 - [info] User directory : /data
node-red_1  | 15 Feb 11:08:08 - [warn] Projects disabled : editorTheme.projects.enabled=false
node-red_1  | 15 Feb 11:08:08 - [info] Flows file     : /data/flows.json
node-red_1  | 15 Feb 11:08:08 - [info] Server now running at https://127.0.0.1:1880/
node-red_1  | 15 Feb 11:08:08 - [info]   GraphQL URL: http://localhost:1880/graphql

node-red_1  | 15 Feb 11:08:08 - [info] Executing Queue DB migrations
node-red_1  | 15 Feb 11:08:08 - [info]   Searching migrations in /data/node_modules/node-red-contrib-chatbot/database/../migrations}
node-red_1  | 15 Feb 11:08:08 - [info]   Found 1 migrations
node-red_1  | 15 Feb 11:08:08 - [info]   Current DB version: 2
node-red_1  | 15 Feb 11:08:08 - [info]   No migrations applied. Done.
node-red_1  | 15 Feb 11:08:08 - [info] Starting flows

BTW the Network error: request to http://0.0.0.0:1880/graphql failed error does not appear anymore since I made those settings.js configurations so it probably doesn't completely ignore them.

Also maybe relevant my docker-compose.yml:

image

guidone commented 1 year ago

Ok, I believe it's the https certificates. I don't use it, I use a different approach (basically nginx proxy manager, see here https://www.notion.so/redbot/Deploying-RedBot-with-Nginx-844c4fe1497845f198db27d82ecb97a5?pvs=4). I'll try to replicate the problem locally and find a better way to authenticate the web socket. Also, I don't use anymore the parameters in settings.js but only env variables (it's possible some of those are not valid anymore), I'll improve the docs in this section

guidone commented 1 year ago

The web socket failing is the Apollo one, it's for the GraphQL subscriptions which are not used yet. I'm upgrading to the latest version of Apollo and removing it, should fix the problem

bfritscher commented 1 year ago

Hi @guidone I also am not able to figure how to use the simulator of MC. Running on a local docker with port mapping 1880. On the flow I can define multiple receiver configuration with id and MC enabled. On the Simulator input widget I do see the dropdown with the correct ids. Howerver on the MC dashboard I do not have the dropdown and the graphql query only returns the default bot.

image

If I do not create receiver configuration, the chat widget did show up but was unable to send with error cannot find chatbot with id "". Also once an id exist, it is no longer possible to select "" in the Simulator In node.

image

What am I missing? What are the correct steps to setup the simulator? Can the simulator be used without receiver / with the universal receiver? Thanks!