Help please with Node-Red "Lost connection to server"
-
Node-Red on my Linux Debian box seems to be having issues now. It keeps saying repeatedly "Lost connection to server, reconnecting..." in the web browser.
I recently updated nodejs for MSR, I wonder if that might be related:
"Bump recommended nodejs version to 16.13.0; versions 14 and 15 will continue to be supported through March 31, 2022"
Nodejs version = v16.13.1
I have tried updating Node-Red that is now version v2.1.4
I also updated npm to version v8.2.0
I am not sure how or where to look at the log file for node red?
This is the contents of the nodered.service file in this directory:
/etc/systemd/system/multi-user.target.wants# systemd service file to start Node-RED [Unit] Description=Node-RED graphical event wiring tool Wants=network.target Documentation=http://nodered.org/docs/hardware/raspberrypi.html [Service] Type=simple # Run as normal pi user - change to the user name you wish to run Node-RED as User=stuart Group=stuart WorkingDirectory=/home/stuart Environment="NODE_OPTIONS=--max_old_space_size=1024" # uncomment and edit next line if you need an http proxy #Environment="HTTP_PROXY=my.httpproxy.server.address" # uncomment the next line for a more verbose log output #Environment="NODE_RED_OPTIONS=-v" # uncomment next line if you need to wait for time sync before starting #ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.* Synchronized to time server"' ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS #ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS # Use SIGINT to stop KillSignal=SIGINT # Auto restart on crash Restart=on-failure RestartSec=20 # Tag things in the log SyslogIdentifier=Node-RED #StandardOutput=syslog [Install] WantedBy=multi-user.target
Thanks
-
sudo journalctl -f -u nodered -o cat
#4 Dec 15:52:58 - [error] [tuya-smart-device:Star Light] Error: Error from socket: connect EHOSTUNREACH 192.168.0.119:6668 4 Dec 15:52:58 - [red] Uncaught Exception: 4 Dec 15:52:58 - [error] Error: connect EHOSTUNREACH 192.168.0.119:6668 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Failed with result 'exit-code'. nodered.service: Service RestartSec=20s expired, scheduling restart. nodered.service: Scheduled restart job, restart counter is at 37. Stopped Node-RED graphical event wiring tool. Started Node-RED graphical event wiring tool. 4 Dec 15:53:20 - [info] Welcome to Node-RED =================== 4 Dec 15:53:20 - [info] Node-RED version: v2.1.4 4 Dec 15:53:20 - [info] Node.js version: v16.13.1 4 Dec 15:53:20 - [info] Linux 4.19.0-18-amd64 x64 LE 4 Dec 15:53:21 - [info] Loading palette nodes 4 Dec 15:53:28 - [info] Settings file : /home/stuart/.node-red/settings.js 4 Dec 15:53:28 - [info] Context store : 'default' [module=memory] 4 Dec 15:53:28 - [info] User directory : /home/stuart/.node-red 4 Dec 15:53:28 - [warn] Projects disabled : editorTheme.projects.enabled=false 4 Dec 15:53:28 - [warn] Flows file name not set. Generating name using hostname. 4 Dec 15:53:28 - [info] Flows file : /home/stuart/.node-red/flows_HP-Thin01.json 4 Dec 15:53:28 - [info] Server now running at http://127.0.0.1:1880/ 4 Dec 15:53:28 - [warn] --------------------------------------------------------------------- Your flow credentials file is encrypted using a system-generated key. If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials. You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change. --------------------------------------------------------------------- 4 Dec 15:53:28 - [info] Starting flows 4 Dec 15:53:29 - [info] [tuya-smart-device:Star Light] Recieved the config {"id":"b2799abf.81c1a8","type":"tuya-smart-device","z":"7bd8e249.bbb27c","deviceName":"Star Light","deviceId":"bf62864a9977909c10zuey","deviceKey":"7904f95d6d266841","deviceIp":"192.168.0.119","retryTimeout":"1000","findTimeout":"1000","tuyaVersion":"3.1","eventMode":"event-both","x":880,"y":180,"wires":[["f6422200.35ec7"]]} 4 Dec 15:53:29 - [info] [tuya-smart-device:Star Light] Event subscription : shouldSubscribeData=>true , shouldSubscribeRefreshData=>true 4 Dec 15:53:29 - [info] [tuya-smart-device:Star Light] Connecting to Tuya with params {"id":"bf62864a9977909c10zuey","key":"7904f95d6d266841","ip":"192.168.0.119","issueGetOnConnect":false,"nullPayloadOnJSONError":false,"version":"3.1"} , findTimeout : 1000 , retryTimeout: 1000 4 Dec 15:53:29 - [info] [tuya-smart-device:Star Light] Recieved the config {"id":"d9079dc4.b93c3","type":"tuya-smart-device","z":"7bd8e249.bbb27c","deviceName":"Star Light","deviceId":"bf62864a9977909c10zuey","deviceKey":"7904f95d6d266841","deviceIp":"192.168.0.119","retryTimeout":"1000","findTimeout":"1000","tuyaVersion":"3.1","eventMode":"event-both","x":320,"y":420,"wires":[["2b35a684.a57a9a","8ed8ece1.387ca"]]} 4 Dec 15:53:29 - [info] [tuya-smart-device:Star Light] Event subscription : shouldSubscribeData=>true , shouldSubscribeRefreshData=>true 4 Dec 15:53:29 - [info] [tuya-smart-device:Star Light] Connecting to Tuya with params {"id":"bf62864a9977909c10zuey","key":"7904f95d6d266841","ip":"192.168.0.119","issueGetOnConnect":false,"nullPayloadOnJSONError":false,"version":"3.1"} , findTimeout : 1000 , retryTimeout: 1000 4 Dec 15:53:29 - [info] Started flows 4 Dec 15:53:30 - [info] [tuya-smart-device:Star Light] initiating the find command 4 Dec 15:53:30 - [info] [tuya-smart-device:Star Light] initiating the find command 4 Dec 15:53:33 - [error] [tuya-smart-device:Star Light] Error: Error from socket: connect EHOSTUNREACH 192.168.0.119:6668 4 Dec 15:53:33 - [red] Uncaught Exception: 4 Dec 15:53:33 - [error] Error: connect EHOSTUNREACH 192.168.0.119:6668 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Failed with result 'exit-code'.
192.168.0.119 is a Tuya WIFI lamp that I had powered off.
I can't seem to update any of these nodes, it doesn't seem to do anything when I try.
-
I've now powered that Tuya light back ON again so it is reachable on the WLAN and now I am able to update the nodes OK and then I rebooted the Linux box. Now the "Lost connection to server, reconnecting..." message has stopped appearing. So seems related to this Tuya node / light.
I then powered OFF the Tuya light again and fingers crossed the "Lost connection to server, reconnecting..." message still hasn't come back, so I think managing to update the Tuya node may have fixed it. I will keep an eye on it.
2/3