FlowFuse / nr-project-nodes

A set of Node-RED nodes for inter-project communication within the FlowFuse platform
Apache License 2.0
5 stars 0 forks source link

Error `Cannot read properties of undefined (reading 'name')` when project-call is used with HTTP-IN nodes #42

Closed Steve-Mcl closed 10 months ago

Steve-Mcl commented 10 months ago

Current Behavior

A customer gets the below error when using the project-call node in the following arrangement: HTTP-INProject-callHTTP-Response

TypeError: Cannot read properties of undefined (reading 'name')

Expected Behavior

Error should not be thrown and and the msg should be passed through the project-call node

Steps To Reproduce

Demo flow that demonstrates the issue

[{"id":"34149b0bcd68777a","type":"project link call","z":"6429d72ae185e590","name":"call remote service","project":"15bfa8d7-4cf3-422f-ae49-6a0cac884804","topic":"mqttRequestResponse","timeout":"30","x":1630,"y":200,"wires":[["41f54684863a5dea","a87dabbcbe091078"]]},{"id":"0efcb628d0592463","type":"comment","z":"6429d72ae185e590","name":"run the below code in your browser console: \\n $.get(\"in\", console.log);","info":"$.get(\"in\", console.log);","x":1650,"y":580,"wires":[]},{"id":"6697b62133ea7794","type":"group","z":"6429d72ae185e590","name":"fail","style":{"label":true},"nodes":["6f28e6372c247a3b","a87dabbcbe091078"],"x":1374,"y":239,"w":532,"h":82},{"id":"6f28e6372c247a3b","type":"http in","z":"6429d72ae185e590","g":"6697b62133ea7794","name":"","url":"/in","method":"get","upload":false,"swaggerDoc":"","x":1450,"y":280,"wires":[["a87dabbcbe091078"]]},{"id":"a87dabbcbe091078","type":"http response","z":"6429d72ae185e590","g":"6697b62133ea7794","name":"","statusCode":"","headers":{},"x":1830,"y":280,"wires":[]},{"id":"1e454968a165211a","type":"group","z":"6429d72ae185e590","name":"success","style":{"label":true},"nodes":["5ead964ca6c62b42","41f54684863a5dea"],"x":1334,"y":79,"w":632,"h":82},{"id":"5ead964ca6c62b42","type":"inject","z":"6429d72ae185e590","g":"1e454968a165211a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1440,"y":120,"wires":[["34149b0bcd68777a"]]},{"id":"41f54684863a5dea","type":"debug","z":"6429d72ae185e590","g":"1e454968a165211a","name":"debug 1","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1850,"y":120,"wires":[]},{"id":"1a07c52e893e745c","type":"group","z":"6429d72ae185e590","name":"the remote service","style":{"label":true},"nodes":["10584c8f8a30de47","c88328e735fecfdc","398f868803fbd9f3","7c8591764ae8c257"],"x":1434,"y":379,"w":442,"h":142},{"id":"10584c8f8a30de47","type":"project link in","z":"6429d72ae185e590","g":"1a07c52e893e745c","name":"request...","project":"all","broadcast":false,"topic":"mqttRequestResponse","x":1520,"y":420,"wires":[["c88328e735fecfdc"]]},{"id":"c88328e735fecfdc","type":"function","z":"6429d72ae185e590","g":"1a07c52e893e745c","name":"payload","func":"msg.payload = \"service says hi\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1635,"y":420,"wires":[["398f868803fbd9f3","7c8591764ae8c257"]],"l":false},{"id":"398f868803fbd9f3","type":"project link out","z":"6429d72ae185e590","g":"1a07c52e893e745c","name":"...response","mode":"return","broadcast":false,"project":"73dc9c1a-5934-468c-bcf3-aec4867f1dd0","topic":"","x":1750,"y":420,"wires":[]},{"id":"7c8591764ae8c257","type":"debug","z":"6429d72ae185e590","g":"1a07c52e893e745c","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1770,"y":480,"wires":[]}]

Environment

Steve-Mcl commented 10 months ago

While technically this issue could be considered a bug, it was a known limitation (and documented in the readme specifically called out the non-support of http-in messages). Therefore, this issue was labelled with "feature-request".

Steve-Mcl commented 10 months ago

Original conversation can be seen on node-red slack #flowfuse channel dated 30th Aug 2023 starting with the words "Potential bug: I’m having issues with Project Call when msg originates from an http in.". @ZJvandeWeg requested me to support this.

Link: https://node-red.slack.com/archives/C02V3BN77GU/p1693434144153549