Lost connection to server, reconnecting

I know that several similar topics have been created, but I was advised to create a new topic.
My editor started displaying this message a few weeks ago. I did not install new nodes, most recent it node-red-contrib-fs but after removing it the issue did not disappear.
This issue started when I was using v0.19.xx (?) version, but I have upgraded to the latest node-red version and also updated by linux as well.

UI works, my flows are running, I can even make changes and deploy flows.

This is my startup log:

Starting Node-RED graphical event wiring tool...
Started Node-RED graphical event wiring tool.
8 Nov 09:02:51 - [info]
Welcome to Node-RED
===================
8 Nov 09:02:52 - [info] Node-RED version: v1.0.2
8 Nov 09:02:52 - [info] Node.js  version: v10.17.0
8 Nov 09:02:52 - [info] Linux 4.9.35-v7+ arm LE
8 Nov 09:02:53 - [info] Loading palette nodes
8 Nov 09:03:24 - [info] Worldmap version 2.1.4
8 Nov 09:03:25 - [info] Dashboard version 2.17.1 started at /ui
8 Nov 09:03:26 - [info] Settings file  : /home/pi/.node-red/settings.js
8 Nov 09:03:26 - [info] HTTP Static    : /home/pi/node-red-static
8 Nov 09:03:26 - [info] Context store  : 'default' [module=memory]
8 Nov 09:03:26 - [info] User directory : /home/pi/.node-red
8 Nov 09:03:26 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
8 Nov 09:03:26 - [info] Flows file     : /home/pi/.node-red/flows_OpenHAB.json
8 Nov 09:03:27 - [info] Server now running at https://127.0.0.1:1880/
8 Nov 09:03:28 - [info] Starting flows
8 Nov 09:03:32 - [info] [worldmap:4dac5582.33b0cc] started at /worldmap
8 Nov 09:03:32 - [info] Started flows
(node:480) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 open listeners added. Use emitter.setMaxListeners() to increase limit
(node:480) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
(node:480) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 open listeners added. Use emitter.setMaxListeners() to increase limit
(node:480) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:1c25415d.b8427f] opened /home/pi/sqlite/nodered ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3187c06b.70165] opened /home/pi/sqlite/diagnostic ok
8 Nov 09:03:33 - [info] [sqlitedb:3bdf3d0e.e69262] opened /home/pi/sqlite/tracker ok
8 Nov 09:03:33 - [info] [sqlitedb:3bdf3d0e.e69262] opened /home/pi/sqlite/tracker ok
8 Nov 09:03:33 - [info] [sqlitedb:3bdf3d0e.e69262] opened /home/pi/sqlite/tracker ok
8 Nov 09:03:33 - [info] [sqlitedb:3bdf3d0e.e69262] opened /home/pi/sqlite/tracker ok
8 Nov 09:03:33 - [info] serial port /dev/ttyUSB1 opened at 57600 baud 8N1
8 Nov 09:03:33 - [info] [mqtt-broker:cea5258a.b34038] Connected to broker: node-red@mqtt://192.168.1.80:1883
8 Nov 09:03:33 - [error] [function:Generate list] TypeError: Cannot read property 'length' of undefined
8 Nov 09:03:33 - [error] [json:cb6467a8.255be8] Unexpected token O in JSON at position 0
8 Nov 09:03:33 - [info] [mqtt-broker:gBridge MQTT] Connected to broker: mqtts://mqtt.gbridge.io:8883
8 Nov 09:03:38 - [error] [sqlite:Diag DB] Error: SQLITE_ERROR: near ",": syntax error

My linux version is:

No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:        8.0
Codename:       jessie

I would start by fixing the easy problems such as the SQL syntax error and the function node error. It is remarkable how often fixing the obvious problems makes others go away even if they look unrelated.

I have resolved the SQL syntax errors and the function node errors. Restarted NR, there are no errors any more, but the issue persists.
Could it be the MaxListenersExceededWarning warning?

Lost connections to MQTT are almost always caused by a duplicate MQTT client id.

Max Listeners is just a warning. Annoying but not fatal.

OK fun fact. I logged into the same editor from a different laptop. And it works.
So it must be an issue with the Chrome running on my computer. I have deleted the cookies and temp files already. Did not help so far.

Delete the cache too.

I had this warning for a long time on one rpi.
I removed node-red-dashboard on this rpi and the warning is gone.

Did that too and nothing so far. I deleted everything except browsing history, password and sign-in data, and form data.
NR works fine from Edge, so definitely Chrome related problem.

Can I check where you are seeing that error, is it the editor, the dashboard (so whichever it is doesn't work at all) or errors in the debug pane or somewhere else?

The error is in the editor. I nothing comes up in the debug and the node statuses are not showing either.

Is the browser developer console (or whatever it is called in Chrome) showing any errors.

Good point. Yes I see the following error coming up every second:
WebSocket connection to 'wss://192.168.1.80:1880/comms' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID
I am using a self signed certificate for Node-Red, but that has not stopped me before. Could it be something on my virus scanner blocking this communication?

I think it will be a Chrome issue. You probably need to tell Chrome to accept the certificate. I presume that you are using https to access node red so it is using tls for the websocket too, but I am out of my comfort zone here so other than suggesting that google for that error and Chrome then I probably can't help much more.

Ah! Now we can see. I believe this is actually a problem of Google's making, they keep trying to stop people from using self-signed certificates. Claiming that they are "Not Secure"! Which is rubbish since they can actually be significantly more secure if done correctly.

Before you go down this route though, do try briefly turning off your antimalware tool to make sure it isn't that.

I fear that, to make this work with Chrome, you would need to generate a full certificate chain with a trusted root CA certificate that you add to Chrome's trusted root certificate store.

Or maybe ditch Google's self-service browser for an alternative one. I just am not sure whether those checks are now built into Chromium which would stop it working on any Chromium based browser. If not, I recommend switching to the Vivaldi browser. Better privacy, some nice features and no phoning home to Google.

2 Likes

Is Chrome letting you browse to https://192.168.1.80:1880 to get the flow layout, or the dashboard layout if you use it? If so it is a bit odd that it allows https but not wss, or am I missing something here?

@Colin: the dashboard and the editor loads, but the editor is not able to connect to the websocket to e.g. update the debug view, or the node status.

@TotallyInformation Thanks for the comments. I have turn off all the settings in my firewall and virus scanner, but since Edge can connect, it appears to be a Chome things and nothing else. I will install Vivaldi and use that for the time being. I am assuming this issue will impact all of us using self-signed certificates going forward, it is just the question of time and when Chrome is getting updated.

1 Like

For those facing the same issue. I have Chrome Version 78.0.3904.97 (Official Build) (64-bit) (got updated just now).
As mentioned by @TotallyInformation and also mentioned here Chrome is silently aborting web socket requests to self signed certificate sites.
The workaround I am using for now (edited) only for Node-Red, is I have created a new shortcut to Chome and added

--ignore-certificate-errors

to the end of the command line. Node Red editor runs fine in this Chrome instance.

Let's see how long this is going to last.

2 Likes

That is a really bad idea. Since it leaves you open to all sorts of attacks on the Internet. At least, please only use that for Node-RED and even then only on a local connection where you can be certain of the path between you and the server.

You probably know that but I just want to make sure that everyone else knows it too.


By the way, if you want to continue to use self-signed certificates, I recommend using the answer in that question you linked to which will show you how to create and consume them "correctly":


Unfortunately, I can't tell you which Chromium browsers might work (I use Vivaldi and Microsoft Edge Dev) because it looks like I issued myself a trusted root certificate back in 2017 and installed it into my trusted certificate store on my dev PC :rofl:

I just had this problem on Chrome v.77, every time I tried refreshing the tab, the Lost Connection error would show up after about 10 seconds. I found a simple workaround that might help others: I simply killed the tab and opened a new one. No more errors, and websockets are working fine.