guidone / node-red-contrib-netatmo-dashboard

Get dashboard JSON payload from NetAtmo.
13 stars 9 forks source link

"ReferenceError: callback is not defined" causes node-red service restart #27

Closed RBrzDVAG closed 1 year ago

RBrzDVAG commented 1 year ago

Hello @guidone ,

since today there are obviously some issues with the connection to dev.netatmo.com and NetAtmo web services as well.

~ $ ping netatmo.com
PING netatmo.com (51.145.143.28) 56(84) bytes of data.
From 51.145.143.28 (51.145.143.28) icmp_seq=1 Destination Host Unreachable
From 51.145.143.28 (51.145.143.28) icmp_seq=2 Destination Host Unreachable
From 51.145.143.28 (51.145.143.28) icmp_seq=3 Destination Host Unreachable
From 51.145.143.28 (51.145.143.28) icmp_seq=4 Destination Host Unreachable
^C
--- netatmo.com ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 7ms

It seems any call to the NetAtmo API causes a crash of node-red

21 Jul 09:35:58 - [error] ReferenceError: callback is not defined
    at ClientRequest.<anonymous> (/home/pi/.node-red/node_modules/node-red-contrib-netatmo-dashboard/netatmo-dashboard.js:46:9)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:502:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
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 4

I thought, open an issue ticket may be a good idea, at least for future reference.

RBrzDVAG commented 1 year ago

Problem solved. Issue has been caused by domain name resolution of my private/internal network.

But the symptom may also appear in the future, if the node is not able to connect to the dev.netatmo-APIs. So, catch this particular error would probably be a good enhancement.