Foddy / node-red-contrib-huemagic

Philips Hue node to control bridges, lights, groups, motion sensors, temperature sensors and Lux sensors using Node-RED.
https://flows.nodered.org/node/node-red-contrib-huemagic
Apache License 2.0
201 stars 67 forks source link

In node-red 2.2.2, when editing a bridge: TypeError: Converting circular structure to JSON #321

Open ddlsmurf opened 2 years ago

ddlsmurf commented 2 years ago

Describe the bug

Whenever configuring a bridge, even in an empty flow of an empty project, crashed the node-red process.

Flow to Reproduce

Just adding any hue node and trying to setup a bridge. (If it makes a difference, I'm not using the process to generate a key, just pasting a previous one). Then trying to use it, eg. putting bulb down and clicking the search button.

Expected behavior Not crash, or at least explain a root cause.

Screenshots

Feb 20 22:09:16 raspi-router node-red-pi[3344]: 20 Feb 22:09:16 - [red] Uncaught Exception:
Feb 20 22:09:16 raspi-router node-red-pi[3344]: 20 Feb 22:09:16 - [error] TypeError: Converting circular structure to JSON
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     --> starting at object with constructor 'Object'
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     |     property 'httpsAgent' -> object with constructor 'Agent'
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     |     property 'sockets' -> object with constructor 'Object'
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     |     ...
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     |     property 'errored' -> object with constructor 'Object'
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     --- property 'config' closes the circle
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     at JSON.stringify (<anonymous>)
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     at /home/nodered/nodered/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:787:31
Feb 20 22:09:16 raspi-router node-red-pi[3344]:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
Feb 20 22:09:16 raspi-router systemd[1]: node-red.service: Main process exited, code=exited, status=1/FAILURE

Please complete the following information:

Additional context

This works with node-red v2.1.6 (have not tried intermediary versions)