Questions about Payload of trigger node

Hello.

I am thinking about this issue.

I think the issue may change depending on the interpretation of the options below.

  • the original msg object
  • the latest msg object

In other words, I seem to handle the whole msg Object, but actually only msg.payload.

Which is the expected movement?

I thought the problem handled msg Object and sent PR.
However, I thought it was meaningless if the policy was different, so I posted it.

Looks like a minor bug in the trigger node in that it seems to be failing if msg.payload doesn't exist.

I think that the reference to msg.req is an artifact. Likely that the trigger node tries to remove the msg.req object? the req object is from ExpressJS and is both big and circular which causes issues sometimes.

Looks like a minor bug in the trigger node in that it seems to be failing if msg.payload doesn't exist.

As you said, this error occurs because msg.payload is missing.

The error of msg.req occurs in the cloneMessage function.

debug.js

node.topics[topic].m2 = RED.util.cloneMessage(msg.payload);

util.js

function cloneMessage(msg) {
    // Temporary fix for #97
    // TODO: remove this http-node-specific fix somehow
    var req = msg.req;
    var res = msg.res;
    delete msg.req;
    delete msg.res;
    var m = clone(msg);
    if (req) {
        m.req = req;
        msg.req = req;
    }
    if (res) {
        m.res = res;
        msg.res = res;
    }
    return m;
}

Well, without wishing to cast any aspersions on Dave and Nick's code (I'm the amateur after all), I would say that the cloneMessage function should have a test to make sure that msg is actually an object. :slight_smile:

However, that isn't the error but you already know that as you've identified it in the issue you raised against the trigger node.

@okhiroyuki as you have already raised an issue, please do not have a separate discussion about it here. If you have more information to add or discuss, then use the issue you have raised

@knolleary
I understand. I'll be careful next time.