Node Red Uncaught exception

I tried installing the module moment-timezone (activating functionGlobalCOntext in settings.js) but node red crashed upon start. So I removed the module, re-edited settings.js but still I can't start Node Red.

This is the log:

Feb 10 18:37:17 liliorest Node-RED[17055]: 10 Feb 18:37:17 - [red] Uncaught Exception:
Feb 10 18:37:17 liliorest Node-RED[17055]: 10 Feb 18:37:17 - Api Error: Unexpected response status; 404
Feb 10 18:37:17 liliorest Node-RED[17055]:     at requireStatusCode200 (/home/boss/.node-red/node_modules/node-hue-api/hue-api/httpPromise.js:100:15)
Feb 10 18:37:17 liliorest Node-RED[17055]:     at _fulfilled (/home/boss/.node-red/node_modules/q/q.js:787:54)
Feb 10 18:37:17 liliorest Node-RED[17055]:     at /home/boss/.node-red/node_modules/q/q.js:816:30
Feb 10 18:37:17 liliorest Node-RED[17055]:     at Promise.promise.promiseDispatch (/home/boss/.node-red/node_modules/q/q.js:749:13)
Feb 10 18:37:17 liliorest Node-RED[17055]:     at /home/boss/.node-red/node_modules/q/q.js:557:44
Feb 10 18:37:17 liliorest Node-RED[17055]:     at flush (/home/boss/.node-red/node_modules/q/q.js:108:17)
Feb 10 18:37:17 liliorest Node-RED[17055]:     at processTicksAndRejections (internal/process/task_queues.js:79:11)
Feb 10 18:37:17 liliorest systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
Feb 10 18:37:17 liliorest systemd[1]: nodered.service: Failed with result 'exit-code'.

From the log it looks like the issue is is node-hue-api. I managed to remove it and it is started again.
But how can I use moment-timezone?

Moment timezone is available in the change node using JSONata.

[{"id":"dfa49b8c.ee6ff","type":"debug","z":"8d8a515a.78af18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":460,"y":1340,"wires":[]},{"id":"74bec0ab.4e3b48","type":"inject","z":"8d8a515a.78af18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"$moment($now()).tz(\"London/Euroupe\").format(\"ha Z\")","payloadType":"jsonata","x":160,"y":1340,"wires":[["dfa49b8c.ee6ff"]]}]
1 Like

Thank you. I was looking to use it in a function, but I can manage it in a change node!

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