# AWS IoT Publishing duplicate msgs

**URL:** <https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009>\
**Category:** General\
**Created:** [29 October 2020 08:28 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009 "2020-10-29T08:28:08Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![DizzyLurker](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@DizzyLurker](https://discourse.nodered.org/u/DizzyLurker)\
**Post date:** [29 October 2020 08:28 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/1 "2020-10-29T08:28:08Z")

</div>

Hi,

I am having an issue where I am using Node-REDs input MQTT nodes to publish/subscribe to topics via the AWS IoT core broker.  
I am using QOS 0.

The issue is when subscribed to the topics on Node-RED I will get duplicate messages. However, at the same time when I subscribe to the AWS web console, only one message will appear.

Any ideas? I am not sure if this is a Node-RED issue or AWS. Was looking at Nod-red as in AWS it's not showing up duplicate. Posting here to see if anyone has the same issue.

Thanks!

---

<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:** [29 October 2020 10:34 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/2 "2020-10-29T10:34:22Z")

</div>

I have a vague recollection that there was a bug that could cause this. Are you using the latest version of node-red?

---

<div class="post-metadata">

**Author:** ![DizzyLurker](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@DizzyLurker](https://discourse.nodered.org/u/DizzyLurker)\
**Post date:** [31 October 2020 05:20 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/3 "2020-10-31T05:20:59Z")

</div>

Hey, Sorry it was a bit rude of me to not include the version number. I am running V1.2.2 on both the publisher and subscriber.

Thanks

---

<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:** [31 October 2020 08:54 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/4 "2020-10-31T08:54:52Z")

</div>

Can you attach a debug node showing what is being published, and another showing the duplicate message reception and post screenshots of each (for the same message obviously) please.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [31 October 2020 10:54 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/5 "2020-10-31T10:54:58Z")

</div>

Also how many `mqtt-in`nodes do you have and what are their topics?

---

<div class="post-metadata">

**Author:** ![DizzyLurker](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@DizzyLurker](https://discourse.nodered.org/u/DizzyLurker)\
**Post date:** [31 October 2020 22:04 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/6 "2020-10-31T22:04:36Z")

</div>

I've done some more testing.

On one instance of Node-RED, I have set up a publish-subscribe. Simply inject the value 200 and I will get the duplicate messages.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/277b9ca2a2967dfcfc147ffa25df838b3e90851a.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/d/4d1be69dc795a820c819b44e44b6695fdda4160c.png)

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

I have hit the inject button 3 times here.

1 - 2 Messages  
2 - 1 Message  
3 - 2 Messages.

In the AWS Online console. I only got 3 messages.

I would understand this if I was using QoS 1. I believe QoS 1 will deliver "at least once" so having duplicates would seem like something that could happen. However, QoS 0 is just "Fire and forget" I am correct in this way of thinking.

---

<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:** [31 October 2020 22:18 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/7 "2020-10-31T22:18:55Z")

</div>

What happens if you use QoS 2?

Are you able to run mosquitto\_sub on the PC? If so does it see 2 messages?

---

<div class="post-metadata">

**Author:** ![DizzyLurker](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@DizzyLurker](https://discourse.nodered.org/u/DizzyLurker)\
**Post date:** [3 November 2020 03:25 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/8 "2020-11-03T03:25:06Z")

</div>

Will do when I have some spare time.

Note - I found that AWS says.  
QoS 0 = zero or more times.  
QoS 1 = one or more times.

Still doesn't explain the issue.

---

<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:** [3 November 2020 08:56 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/9 "2020-11-03T08:56:33Z")

</div>

If it doesn't support QoS 2 then obviously you can't try that (which was an attempt to understand the problem better).  
Whatever the cause, if it is causing a problem and you want a workaround for the short term then you could add an RBE node after the MQTT In node to suppress messages with the same payload, or if you don't want to suppress them if they are not close together then you could use a Trigger node configured like this, which in the even to two or more messages close together will discard the first ones and just send on the last.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/086cb94f95d77e8be71abf570d35c9fc08521998.png)

---

<div class="post-metadata">

**Author:** ![DizzyLurker](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@DizzyLurker](https://discourse.nodered.org/u/DizzyLurker)\
**Post date:** [4 November 2020 08:36 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/10 "2020-11-04T08:36:45Z")

</div>

Thanks mate. I like the dark theme you've got there!  
I ended up doing the below as a workaround.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/8/389c61987513ca25e3b736181c3d1f566ea02e10.png)

---

<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:** [4 November 2020 09:07 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/11 "2020-11-04T09:07:52Z")

</div>

> [@DizzyLurker](#):
>
> I like the dark theme you've got there!

> **[@node-red-contrib-themes/midnight-red](https://www.npmjs.com/package/@node-red-contrib-themes/midnight-red)**
>
> A gorgeous dark theme for Node-RED. Latest version: 2.2.3, last published: 2 years ago. Start using @node-red-contrib-themes/midnight-red in your project by running \`npm i @node-red-contrib-themes/midnight-red\`. There is 1 other project in the npm...

---

<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:** [3 January 2021 09:08 UTC](https://discourse.nodered.org/t/aws-iot-publishing-duplicate-msgs/35009/12 "2021-01-03T09:08:04Z")

</div>

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