node-red-contrib-cloud-firestore icon indicating copy to clipboard operation
node-red-contrib-cloud-firestore copied to clipboard

Firestore node errors not propagated to Catch nodes

Open rayroutledge opened this issue 3 months ago • 0 comments

Description: When the write node encounters an error (for example, updating a non-existent document), the error is logged to the console and the node status turns red, but the error is not caught by Node-RED Catch nodes.

Root Cause: The node calls node.error(err) inside a Promise .catch() without signalling that the node has completed processing. Node-RED Catch nodes only capture asynchronous errors if done(err) is used to indicate a failed operation.

Proposed Fix: Inside the FirestoreWrite node, update the .catch() block as follows:

.catch((err) => {
    node.status({fill:"red",shape:"dot",text:"error"});
    if(done) {
        done(err); // Propagate error to Catch node
    } else {
        node.error(err, msg);
    }
});

I needed this fix to properly capture errors. While I patched this specific instance successfully, similar issues may exist in other parts of the node that handle errors asynchronously.

rayroutledge avatar Oct 04 '25 20:10 rayroutledge