# Problem with join node

**URL:** <https://discourse.nodered.org/t/problem-with-join-node/41668>\
**Category:** General\
**Created:** [26 February 2021 08:52 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668 "2021-02-26T08:52:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [26 February 2021 08:52 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/1 "2021-02-26T08:52:10Z")

</div>

Hey,  
somehow I dont understand the join node.  
I would like to combine some payloads but allways receive this error:

"Message missing key property 'msg.topic' - cannot add to object"

I use some buttons wich sends numbers as payload and I also set topic for this:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/da40e7c134f90dcd0e69b33a8ae6498dc2cf830e.png)

I would like to combine some input until 4 inputs are made and then send an output from join node, but it wont work.

What am I missing, why the join node dont add inputs??

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [26 February 2021 09:06 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/2 "2021-02-26T09:06:57Z")

</div>

And what is the value of msg.test?

Try adding test as a string.

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [26 February 2021 09:17 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/3 "2021-02-26T09:17:56Z")

</div>

well changing msg to string seems to work, but I thoght Topic: msg.test ist the topic with value of payload, in my case 1, I was expecting this output: test:1

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 February 2021 09:35 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/4 "2021-02-26T09:35:23Z")

</div>

> [@sfedo](#):
>
> I use some buttons wich sends numbers as payload and I also set topic for this:  
> ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/a/da40e7c134f90dcd0e69b33a8ae6498dc2cf830e.png)

you have set the topic to come from `msg` - that should probably be set to `string`

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 February 2021 09:36 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/5 "2021-02-26T09:36:15Z")

</div>

> [@sfedo](#):
>
> I was expecting this output: test:1

how have you set join node? key/val mode?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 February 2021 09:37 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/6 "2021-02-26T09:37:06Z")

</div>

In a button setting Topic to msg.test means set msg.topic in the output message to the value of msg.test from an input message. If you just want the topic on the output set to the string "test" then set Topic to String type, test

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/0770cf16104d7fe287c5d60d85d2cd4fc6b29a9c.png)

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [26 February 2021 09:38 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/7 "2021-02-26T09:38:59Z")

</div>

Yes I have set it to string and it works now, as expected,  
but I try to understand why is msg.test doesnt work as topic? What do my node do? set the topic "test" on the msg value, so on "1"? Does it means that the topic is going to be removed?

yes it was key/val mode, but I noticed yet that the string fits better my purpose.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 February 2021 09:40 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/8 "2021-02-26T09:40:10Z")

</div>

> [@sfedo](#):
>
> but I try to understand why is msg.test doesnt work as topic

if the msg contains a property called "test" the value of msg.test will be used. So if msg.test doesnt exist, then undefined is sent - i.e. no topic - resulting in ""Message missing key property 'msg.topic' - cannot add to object""

I suspect you are new to node-red, I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [26 February 2021 09:44 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/9 "2021-02-26T09:44:20Z")

</div>

I work with node red for 2 weeks now, so ye pretty new and I still have troubles to understand the msg and topic functions and how this works together. I will watch the playlist, thank you!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 February 2021 09:52 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/10 "2021-02-26T09:52:17Z")

</div>

Here is an example showing msg.test to set the topic. Though I can't actually think of a use case where this would be helpful.

```auto
[{"id":"233a4bbc.3b1b64","type":"debug","z":"37f5b818.697af8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":680,"wires":[]},{"id":"58a81137.6c262","type":"ui_button","z":"37f5b818.697af8","name":"","group":"a8e4a3.d31edb6","order":3,"width":0,"height":0,"passthru":true,"label":"button topic test","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"test","topicType":"msg","x":300,"y":680,"wires":[["233a4bbc.3b1b64"]]},{"id":"57e7e1be.269268","type":"inject","z":"37f5b818.697af8","name":"msg.test: topic1","props":[{"p":"test","v":"topic1","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":120,"y":720,"wires":[["58a81137.6c262"]]},{"id":"17a4e8fc.b7d357","type":"inject","z":"37f5b818.697af8","name":"msg.test: topic2","props":[{"p":"test","v":"topic2","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"str","x":120,"y":640,"wires":[["58a81137.6c262"]]},{"id":"a8e4a3.d31edb6","type":"ui_group","name":"Chart","tab":"8032fe72.980b98","order":3,"disp":false,"width":"12","collapse":false},{"id":"8032fe72.980b98","type":"ui_tab","name":"PnH","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 March 2021 09:52 UTC](https://discourse.nodered.org/t/problem-with-join-node/41668/11 "2021-03-12T09:52:33Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
