Node Red Error: Cannot create property '_msgid' on string
Node Red Error: Cannot create property '_msgid' on string
我在 Node Red 中设置了这个:
使用此 SQL(函数)代码:
msg.topic = "INSERT INTO temperature(temp, date) VALUES('" +
msg.payload + "', 'NOW()')";
return msg.topic;
并出现此错误:
function : (error)
"TypeError: Cannot create property '_msgid' on string 'INSERT INTO
temperature(temp, date) VALUES('1.23', 'NOW()')'"
我做错了什么?
您的函数只是 return 字符串 (msg.topic),它需要 return 整个对象。
msg.topic = "INSERT INTO temperature(temp, date) VALUES('" + msg.payload + "', 'NOW()')";
return msg;
我在 Node Red 中设置了这个:
使用此 SQL(函数)代码:
msg.topic = "INSERT INTO temperature(temp, date) VALUES('" +
msg.payload + "', 'NOW()')";
return msg.topic;
并出现此错误:
function : (error)
"TypeError: Cannot create property '_msgid' on string 'INSERT INTO
temperature(temp, date) VALUES('1.23', 'NOW()')'"
我做错了什么?
您的函数只是 return 字符串 (msg.topic),它需要 return 整个对象。
msg.topic = "INSERT INTO temperature(temp, date) VALUES('" + msg.payload + "', 'NOW()')";
return msg;