Nodered ist failing every X Hours, can't find the Error

Hello,
my nodered Application is failing every X hours. After that I can start the application with a simple #dietpi-services start node-red

The Application runs on an RaspberryPi with "dietpi" as OS.

Is the Solax-cloud-api Module my Problem ?

Kind regards,
Steve

This ist the Log from #status node-red

[FAILED] DietPi-Services | ● node-red.service - Node-RED (DietPi)
     Loaded: loaded (/etc/systemd/system/node-red.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-02-20 07:41:35 CET; 1h 34min ago
    Process: 630 ExecStart=/mnt/dietpi_userdata/node-red/node_modules/.bin/node-red -u /mnt/dietpi_userdata/node-red (code=exited, status=1/FAILURE)
   Main PID: 630 (code=exited, status=1/FAILURE)
        CPU: 56min 56.557s

Feb 20 07:41:35 DietPi node-red[630]:     [Symbol(kCapture)]: false
Feb 20 07:41:35 DietPi node-red[630]:   }
Feb 20 07:41:35 DietPi node-red[630]: }
Feb 20 07:41:35 DietPi node-red[630]: 20 Feb 07:41:35 - [red] Uncaught Exception:
Feb 20 07:41:35 DietPi node-red[630]: 20 Feb 07:41:35 - [error] ReferenceError: res is not defined
Feb 20 07:41:35 DietPi node-red[630]:     at /mnt/dietpi_userdata/node-red/node_modules/@virtualbat/node-red-contrib-solax-cloud-api-client/solax-api-client.js:55:73
Feb 20 07:41:35 DietPi node-red[630]:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Feb 20 07:41:35 DietPi systemd[1]: node-red.service: Main process exited, code=exited, status=1/FAILURE
Feb 20 07:41:35 DietPi systemd[1]: node-red.service: Failed with result 'exit-code'.
Feb 20 07:41:35 DietPi systemd[1]: node-red.service: Consumed 56min 56.557s CPU time.
dietpi@DietPi:~$ 
dietpi@DietPi:~$ 
dietpi@DietPi:~$ sudo dietpi-services start node-red

 DietPi-Services
─────────────────────────────────────────────────────
 Mode: start node-red

[  OK  ] DietPi-Services | start : node-red

That is a safe bet...

A node must handle its own errors to avoid crashing node-red.

Unfortunately, the source code doesnt appear to be on a public repository so there is no place to raise issues.

If you want a "workaround" then edit the file /mnt/dietpi_userdata/node-red/node_modules/@virtualbat/node-red-contrib-solax-cloud-api-client/solax-api-client.js - change the function setNodeStatus as follows...

        function setNodeStatus(res){
            if(res && res.status===200){
                if(res.data.success){
                    node.status({fill:"green",shape:"dot",text:"connected"});
                }else{
                    node.status({fill:"orange",shape:"dot",text:"Chech parameters: "+res.data.exception});
                }
            }else{
                node.status({fill:"red",shape:"dot",text:"Cannot connect: " + (res && res.status) || "unknown"});
            }
        }

Wow, that was fast :slight_smile: Thank you. I changed the code and will monitor it.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.