The docs say:
Messages usually have a
payloadproperty - 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:
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:
[{"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":[]}]



