# Function Node on start not sending message

**URL:** <https://discourse.nodered.org/t/function-node-on-start-not-sending-message/88569>\
**Category:** General\
**Tags:** function-node\
**Created:** [9 June 2024 04:01 UTC](https://discourse.nodered.org/t/function-node-on-start-not-sending-message/88569 "2024-06-09T04:01:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DustyButler](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dustybutler/32/57426_2.png) [@DustyButler](https://discourse.nodered.org/u/DustyButler)\
**Post date:** [9 June 2024 04:01 UTC](https://discourse.nodered.org/t/function-node-on-start-not-sending-message/88569/1 "2024-06-09T04:01:45Z")

</div>

In V2.2.2, the Function Node will send a message with code in the On Start tab, but V3.1.9 no longer outputs messages, and returns error messages.

node.send() does not send anything and no errors.  
return msg; gives a "ReferenceError: msg is not defined"

Am i missing something?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 June 2024 05:41 UTC](https://discourse.nodered.org/t/function-node-on-start-not-sending-message/88569/2 "2024-06-09T05:41:53Z")

</div>

> [@DustyButler](#):
>
> node.send() does not send anything

It does, but it is dependant on order of creation and other factors. Read this: [Messages sent via "On Start" only reliable on partial deploy but not during " nodered.service" start. Possible? - #7 by Steve-Mcl](https://discourse.nodered.org/t/messages-sent-via-on-start-only-reliable-on-partial-deploy-but-not-during-nodered-service-start-possible/83989/7)

> [@DustyButler](#):
>
> return msg; gives a "ReferenceError: msg is not defined"

As I would expect. The function will not have received an input msg, so it does not exist. (On start is the start of it's life's time & has never received a message)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 September 2024 05:42 UTC](https://discourse.nodered.org/t/function-node-on-start-not-sending-message/88569/3 "2024-09-07T05:42:38Z")

</div>

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