Function tried to send a message of type string

I.m sure this has been asked before but can't find a solution and tried searching for the relevant javascript solution but didn't help. I'm trying to get 2 values out of a function and get "Function tried to send a message of type string"
Function code below.

global.set("pushed", 1);
global.set("override", 0);
var p = global.get("pushed");
var o = global.get("override");
var msg1=msg.payload;
var msg2=msg.payload
return [ msg1 , msg2 ];

1 Like



var msg1={};
var msg2={};
1 Like

That worked perfectly. Many thanks. Hope it helps other newbies to JS and Node-Red.

I think you should also carefully read the manual and do some experiments to understand how to deal with msg Object and its properties.

Thank you. I'll bookmarked that page and will give it a go.