Hi There!
Sorry if this has been asked before however I just had the following problem. Flow:
[{"id":"c0434d6638a5e339","type":"change","z":"d7f182b9ccdd6c48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t fubar: \"sadasd\",\t msg: msg.payload\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":497,"y":534,"wires":[["34f8a07edb2fde5c"]]},{"id":"34f8a07edb2fde5c","type":"debug","z":"d7f182b9ccdd6c48","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":742,"y":610,"wires":[]},{"id":"4926c043fb635466","type":"http in","z":"d7f182b9ccdd6c48","name":"","url":"/test","method":"get","upload":false,"swaggerDoc":"","x":361,"y":446,"wires":[["c0434d6638a5e339"]]}]
The set msg.payload node has jsonata definition which isn't in error if looking at the properties sidebar:
When I go to the test tab there is an error:
The problem is that I can deploy this broken Jsonata no problems. When I then make the web request to the http-in node, Node-RED crashes with:
rednode-mnmn_1 | 29 Jul 15:19:32 - [red] Uncaught Exception:
rednode-mnmn_1 | 29 Jul 15:19:32 - [error] TypeError: Converting circular structure to JSON
rednode-mnmn_1 | --> starting at object with constructor 'Socket'
rednode-mnmn_1 | | property 'parser' -> object with constructor 'HTTPParser'
rednode-mnmn_1 | --- property 'socket' closes the circle
rednode-mnmn_1 | at JSON.stringify (<anonymous>)
rednode-mnmn_1 | at /usr/src/node-red/node_modules/jsonata/jsonata.js:5474:29
rednode-mnmn_1 | at String.replace (<anonymous>)
rednode-mnmn_1 | at populateMessage (/usr/src/node-red/node_modules/jsonata/jsonata.js:5473:31)
rednode-mnmn_1 | at catchHandler (/usr/src/node-red/node_modules/jsonata/jsonata.js:5558:25)
minemind_rednode-mnmn_1 exited with code 1
I tried doing the same with an inject node, but that didn't break Node-RED, it seems to only happen when an http-in is used.
I was wondering why Node-RED doesn't run a test on the Jsonata property on edit save? That would have shown me the error far earlier. (I spent about half an hour search for this mistake on another server because I didn't check the test tab )
I'm using 3.0.2, perhaps this is already addressed in 3.1.x?
Cheers!