# Function node sends multiple messages instead of one

**URL:** <https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843>\
**Category:** General\
**Tags:** function-node\
**Created:** [20 December 2023 00:24 UTC](https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843 "2023-12-20T00:24:19Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ChrisG](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@ChrisG](https://discourse.nodered.org/u/ChrisG)\
**Post date:** [20 December 2023 07:36 UTC](https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843/5 "2023-12-20T07:36:54Z")

</div>

Here is the json for the issue:-

[{"id":"4b211f23c08b43f4","type":"tab","label":"Flow 5","disabled":false,"info":"","env":},{"id":"af5483388c10dfb5","type":"function","z":"4b211f23c08b43f4","name":"Combine 6 global variables into one payload","func":"msg.payload = \n\n{\n\n "solarPvId" : flow.get("solarPvId"),\n "solarPvTimestamp" : flow.get("solarPvTimestamp"),\n "currentGeneratingUnitsW" : flow.get("currentGeneratingUnitsW"),\n "exportingUnintsW" : flow.get("exportingUnintsW"),\n "currentDayGeneratedW" : flow.get("currentDayGeneratedW"),\n "currentDayExportedW" : flow.get("currentDayExportedW")\n\n}\nnode.send(msg);\n\n//return msg;\n\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":,"x":850,"y":140,"wires":[["8284852709ca22a8"]]},{"id":"8284852709ca22a8","type":"debug","z":"4b211f23c08b43f4","name":"dB payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1190,"y":140,"wires":},{"id":"638a99cd0d575a4e","type":"msg-speed","z":"4b211f23c08b43f4","name":"","frequency":"hour","interval":1,"estimation":false,"ignore":false,"pauseAtStartup":false,"topicDependent":false,"x":510,"y":140,"wires":[["af5483388c10dfb5"],]},{"id":"ea1bc11cc99b2091","type":"inject","z":"4b211f23c08b43f4","name":"Every 1m","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":"10","topic":"","payload":"","payloadType":"date","x":250,"y":140,"wires":[["638a99cd0d575a4e"]]}]

obviously the function isn't getting any data now as the flow variables aren't being created, but the output is still showing messages at 1/second (timestamp on when something comes from a node within the flow):-

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f12d81b37a53f099aec638fb56ee0b8ef179940.png)

---

_[View the full topic](https://discourse.nodered.org/t/function-node-sends-multiple-messages-instead-of-one/83843)._
