Skip to content

Cannot Delete Retained MQTT Messages Anymore #7500

@PeterBurner

Description

@PeterBurner

Checkboxes for prior research

Describe the bug

We are using the NodeJS package @aws-sdk/client-iot-data-plane to interact with AWS IoT Core. Since the update from v3.928.0 to v3.929.0 we can no longer delete retained messages. We usually send undefined in the payload of the PublishCommand. However with the new SDK version the topic is actually set to an empty object ({}) instead of being deleted. We also tried sending null or empty string ''. Always with the same result.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/client-iot-data-plane@3.928.0 --> @aws-sdk/client-iot-data-plane@3.929.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v22.18.0

Reproduction Steps

  1. Publish a payload to an MQTT topic.
  2. Publish undefined to the same MQTT topic.
  3. Check whether retained topic still exists. --> Should result in ResourceNotFoundException
import {
  GetRetainedMessageCommand,
  IoTDataPlaneClient,
  PublishCommand
} from '@aws-sdk/client-iot-data-plane';

const client = new IoTDataPlaneClient({
  region: 'eu-central-1'
});

await client.send(
  new PublishCommand({
    payload: JSON.stringify({
      test: 'data'
    }),
    retain: true,
    topic: 'test'
  })
);

console.log(
  'topic exists:',
  await client
    .send(
      new GetRetainedMessageCommand({
        topic: 'test'
      })
    )
    .then(() => true)
    .catch(() => false)
);

await client.send(
  new PublishCommand({
    payload: undefined,
    retain: true,
    topic: 'test'
  })
);

console.log(
  'topic exists:',
  await client
    .send(
      new GetRetainedMessageCommand({
        topic: 'test'
      })
    )
    .then(() => true)
    .catch(() => false)
);

Observed Behavior

Retained topic is not being deleted.

Expected Behavior

Retained topic should have been deleted.

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p1This is a high priority issuepotential-regressionMarking this issue as a potential regression to be checked by team memberresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.workaround-availableThis issue has a work around available.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions