node-red-contrib-amqp
node-red-contrib-amqp copied to clipboard
TypeError returned from debug node
Getting a TypeError cannot read property "close" of null. I've tried multiple configurations using the default and the topology. Connecting to a RabbitMQ 3.4.4 server - which could be the issue. Will install a local instance to see if it persists.
@pmclean1964 +1 It isn't something related to the version, the same issue shows up on 3.6.5. Locally everything's ok. Something goes wrong when trying to connect to an external rabbitmq server. I have mine on the same network, running from a docker container. The node is showing up "connecting" but there's no connection at all.
When are you getting the error? Because with all our configurations it works, both local, dockerized and external RabbitMQ servers have no connection problems. I need to have a little more info, so that I can reproduce the error.
@abreits My external rabbitmq server is running on a Mac inside a docker container
+1 on this... I have ActiveMQ running on one EC2 instance in AWS and Node-Red on another EC2 instance and they are in the same VPC (=no firewalls in between). As soon as I hit Deploy I get the following in the Log (one input and one output node):
0|node-red | 31 Jan 13:48:35 - [error] [amqp in:c5a2e3c7.ede5b] Error stopping node: TypeError: Cannot read property 'close' of null
0|node-red | 31 Jan 13:48:35 - [error] [amqp out:3464ab2d.a8007c] Error stopping node: TypeError: Cannot read property 'close' of null
Anything?
Looks to me like this happens when the connection does not complete, so the node.src
value never gets set before the node is cleaned up. Here's my tweak.
node.on("close", function () {
if(node.src != null) {
node.src.close().then(function () {
node.server.freeConnection();
node.status({ fill: "red", shape: "ring", text: "disconnected" });
}).catch(function (err) {
node.server.freeConnection();
node.status({ fill: "red", shape: "dot", text: "disconnect error" });
node.error("AMQP " + node.amqpType + " node disconnect error: " + err.message);
});
} else {
node.log("No need to close the node. There us no connection.");
}
});