Hello,
I've been looking around in the forum searching for this issue but did not found it. Hopefully someone can help me with this. I created a custom node that simply listens for an HTTP POST request and sends a message through its single output.
The query part of the code is like this:
RED.httpNode.post('/TriggerScenario_' + config.scenarioName, function(req, res) {
var body = req.body;
if (body.messageType == "execute_trigger") {
node.status({fill:"yellow", shape:"ring", text:"status.executing"});
setTimeout( function() {
node.emit('input', {});
res.sendStatus(200);
}, 2000);
} else {
res.sendStatus(500);
}
});
And the input
event is properly listened here:
node.on('input', function (msg, send, done) {
// Compatibility against v < 1.0
send = send || function() { node.send.apply(node,arguments) };
node.status({fill:"green", shape:"ring", text:"status.executed"});
msg.payload = {
scenarioName : config.scenarioName
};
send(msg);
if (done) {
done();
}
});
The issue:
HTTP request and input
event work fine, but the message is only sent as long as I don't press over the Deploy button.
If I make whatever change in the flow and deploy it, the HTTP request is still received and the input
event triggered, but the message is not anymore sent. Stopping and restarting the NodeRED server makes it work again, but only until the next Deploy, where it stops working.
Additional info:
I've experienced this issue after upgrading to v1.0.6. Find some traces below illustrating that the "send" event is being generated, though it does not push out the message:
Any help is more than welcome as I'm running out of ideas to understand what is happening. Thank you!