# Is payload required by design or is it a bug?

**URL:** <https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300>\
**Category:** General\
**Created:** [26 February 2020 18:40 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300 "2020-02-26T18:40:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![techraf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/techraf/32/17389_2.png) [@techraf](https://discourse.nodered.org/u/techraf)\
**Post date:** [26 February 2020 18:40 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300/1 "2020-02-26T18:40:57Z")

</div>

[The docs](https://nodered.org/docs/user-guide/messages) say:

> Messages usually have a `payload` property - this is the default property that most nodes will work with.

What about nodes that don't work with payload, but just pass the message?  
Is `payload` property required (i.e. intended so by design) for them to function properly?

I am asking because:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/5/45a5d880d70ff263ff38cad72dbf48fa94bee074.png)

and I don't think this is a correct response from Node-RED.

Even if the `payload` property was required by design, the error message could be more informational, rather than:

`"TypeError: Cannot read property 'req' of undefined"`

Shall I submit a new issue on GitHub?

* * *

The code:

```auto
[{"id":"980a0f42.21944","type":"trigger","z":"bf313411.baefb8","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"2","extend":true,"units":"s","reset":"","bytopic":"all","name":"trigger 2s","x":600,"y":120,"wires":[["e476e237.62452"]]},{"id":"67dfcc82.61e904","type":"inject","z":"bf313411.baefb8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":100,"wires":[["e4c25eb6.bae79","c45993a0.db376"]]},{"id":"e476e237.62452","type":"debug","z":"bf313411.baefb8","name":"this doesn't","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":750,"y":120,"wires":[]},{"id":"e4c25eb6.bae79","type":"function","z":"bf313411.baefb8","name":"emit new message with no payload","func":"var new_msg = {};\n\nnew_msg.key1 = \"value1\";\nnew_msg.key2 = \"value2\";\n\nreturn new_msg;","outputs":1,"noerr":0,"x":380,"y":120,"wires":[["980a0f42.21944"]]},{"id":"c45993a0.db376","type":"function","z":"bf313411.baefb8","name":"emit new message with payload","func":"var new_msg = {};\n\nnew_msg.key1 = \"value1\";\nnew_msg.key2 = \"value2\";\nnew_msg.payload = true;\n\nreturn new_msg;","outputs":1,"noerr":0,"x":370,"y":80,"wires":[["b91be038.da8f1"]]},{"id":"b91be038.da8f1","type":"trigger","z":"bf313411.baefb8","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"1","extend":true,"units":"s","reset":"","bytopic":"all","name":"trigger 1s","x":600,"y":80,"wires":[["b29fd727.5dd278"]]},{"id":"b29fd727.5dd278","type":"debug","z":"bf313411.baefb8","name":"this works","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":750,"y":80,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 February 2020 18:51 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300/2 "2020-02-26T18:51:05Z")

</div>

well importing your flow works for me... 🙂

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/5/45e391f880bdefed8cd4fd6710dc68fc84df78ef.png)

But then the export has both triggers set to 1 sec - so maybe you have it configured differently ?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/d/1d999a90cd9f9dde67a1ada8a3d63c1c7dc87925.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [26 February 2020 19:00 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300/3 "2020-02-26T19:00:11Z")

</div>

You are hitting this known issue: [https://github.com/node-red/node-red/issues/2399](https://github.com/node-red/node-red/issues/2399)

That is already fixed and will be in 1.0.4 - which is the code @dceejay is already running which is why it works for him.

---

<div class="post-metadata">

**Author:** ![techraf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/techraf/32/17389_2.png) [@techraf](https://discourse.nodered.org/u/techraf)\
**Post date:** [26 February 2020 19:05 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300/4 "2020-02-26T19:05:41Z")

</div>

> [@dceejay](#):
>
> But then the export has both triggers set to 1 sec - so maybe you have it configured differently ?

Sorry, you must have taken the code from my initial message, but looked at the image from the latest edit.

I decided to make some beautification and replaced both: the code and the image to avoid confusion, yet I created one 🙂

---

<div class="post-metadata">

**Author:** ![techraf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/techraf/32/17389_2.png) [@techraf](https://discourse.nodered.org/u/techraf)\
**Post date:** [26 February 2020 19:07 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300/5 "2020-02-26T19:07:50Z")

</div>

> [@knolleary](#):
>
> You are hitting this known issue: [https://github.com/node-red/node-red/issues/2399](https://github.com/node-red/node-red/issues/2399)

Oh, shame on me.

Thanks for the answer.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 February 2020 19:29 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300/6 "2020-02-26T19:29:58Z")

</div>

Just good timing, as 1.0.4 is coming soon

---

<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:** [11 March 2020 19:30 UTC](https://discourse.nodered.org/t/is-payload-required-by-design-or-is-it-a-bug/22300/7 "2020-03-11T19:30:09Z")

</div>

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