# Questions about Payload of trigger node

**URL:** <https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093>\
**Category:** General\
**Created:** [13 December 2019 00:00 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093 "2019-12-13T00:00:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![okhiroyuki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/okhiroyuki/32/15056_2.png) [@okhiroyuki](https://discourse.nodered.org/u/okhiroyuki)\
**Post date:** [13 December 2019 00:00 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093/1 "2019-12-13T00:00:08Z")

</div>

Hello.

I am thinking about [this issue](https://github.com/node-red/node-red/issues/2399).

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?

---

<div class="post-metadata">

**Author:** ![okhiroyuki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/okhiroyuki/32/15056_2.png) [@okhiroyuki](https://discourse.nodered.org/u/okhiroyuki)\
**Post date:** [13 December 2019 00:17 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093/2 "2019-12-13T00:17:32Z")

</div>

I thought the problem handled msg Object and sent [PR](https://github.com/node-red/node-red/issues/2399).  
However, I thought it was meaningless if the policy was different, so I posted it.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [13 December 2019 01:00 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093/3 "2019-12-13T01:00:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![okhiroyuki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/okhiroyuki/32/15056_2.png) [@okhiroyuki](https://discourse.nodered.org/u/okhiroyuki)\
**Post date:** [13 December 2019 12:53 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093/4 "2019-12-13T12:53:49Z")

</div>

> 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

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

```

util.js

```auto
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;
}

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [13 December 2019 13:06 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093/5 "2019-12-13T13:06:41Z")

</div>

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. 🙂

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.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 December 2019 13:12 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093/6 "2019-12-13T13:12:28Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![okhiroyuki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/okhiroyuki/32/15056_2.png) [@okhiroyuki](https://discourse.nodered.org/u/okhiroyuki)\
**Post date:** [13 December 2019 13:55 UTC](https://discourse.nodered.org/t/questions-about-payload-of-trigger-node/19093/7 "2019-12-13T13:55:46Z")

</div>

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