IMD SolutionComputing LibraryShop main store

Troubleshooting

Why MQTT Transmission fails when MQTT Engine connects to AWS IoT Core

Edge computing and IIoT Published 5 min read

Short answer

MQTT Transmission works only in the Sparkplug spBv1.0 topic namespace and also subscribes to NCMD and publishes retained messages, so an AWS IoT Core policy scoped to custom namespaces denies it even when MQTT Engine connects with the same certificate. Trace TahuClient at TRACE level, allow every spBv1.0 resource plus RetainPublish, and keep payloads under 128 KB.

On this page
  1. Read the symptom correctly
  2. Why Engine passes and Transmission fails
  3. Fixing the policy step by step
  4. Sizing a Sparkplug payload against the IoT Core message size limit
  5. What each observation proves
  6. Questions asked

When MQTT Engine connects to AWS IoT Core but MQTT Transmission keeps dropping into its reconnect cycle with authentication_failure in the IoT Core logs, the cause is the AWS IoT policy, not the certificate. MQTT Transmission works exclusively in the Sparkplug spBv1.0 topic namespace and issues Sparkplug-required operations, including the NCMD subscription and retained publishes. A policy written to allow only your custom namespaces denies those operations and the broker disconnects the client. Reusing the Engine certificate proves nothing beyond the connect itself.

Read the symptom correctly #

The reported trace shows Transmission attempting the broker endpoint on port 8883, waiting out a 50-second connection timeout, then retrying every 1000 milliseconds with Failed to achieve connected state. A client that connects and then reports Connection lost has passed TLS and client authentication; the disconnect happens after the session starts, which is exactly what an unauthorized publish or subscribe looks like on IoT Core. The message that the credentials are fine is correct up to the connect and wrong after it.

Tests with a generic MQTT client using the same certificate and client ID only prove the operations that client tried. A manual publish to one allowed topic validates that topic, not the whole Sparkplug set.

Why Engine passes and Transmission fails #

MQTT Engine can be configured with custom namespace filters and can run with Sparkplug processing off, so its traffic stays inside the topics your policy already allows. MQTT Transmission has no namespace setting: by design it publishes data with the pattern spBv1.0/<Group ID>/NDATA/<Edge Node ID>, and as a Sparkplug edge node it also subscribes to its NCMD command topic and publishes retained birth and death messages. The documented AWS IoT requirement for retained publishing is that the device be allowed to connect, to publish MQTT messages, and to publish retained messages. Your site's policy, scoped by namespace with no spBv1.0 root, denies all of that.

Renaming the Group ID and Edge Node ID so the NDATA path falls inside an allowed subtopic is not enough: the NCMD subscription and the retained publishes are still denied. Changing the Transmission Data Format Type does not touch the topic root and changes nothing.

Fixing the policy step by step #

  1. Set the Ignition TahuClient logger to TRACE and let Transmission attempt one connection. The trace lists every publish and subscription topic it issues.
  2. Correlate that timestamp with the AWS IoT Core logs and record the exact denied action and resource for each authentication_failure.
  3. Attach a policy to the certificate that allows, on topic ARNs, iot:Connect for the client ID, iot:Publish and iot:Subscribe on spBv1.0/... resources, iot:Receive, and the retained-publish permission for every spBv1.0 publish resource. Enabling RetainPublish alone does not fix it; every traced resource must be allowed.
  4. Reconnect Transmission and confirm it stays online instead of re-entering the 1000-millisecond retry cycle.
  5. Confirm the full chain: the session holds, the NCMD subscription is accepted, and data arrives under the expected spBv1.0 topic with no new authorization failures in the IoT Core logs.

If your infrastructure team cannot widen the policy to the spBv1.0 namespace, MQTT Transmission is not a drop-in for an Engine custom-namespace workflow. Transmission also supports scripted publishes, but no load measurement exists for thousands of tags through a scripted path, so benchmark any scripted design at your real tag count before committing to it. The mechanics of command topics are covered in publishing Sparkplug NCMD and DCMD commands.

Sizing a Sparkplug payload against the IoT Core message size limit #

A policy fix is not the end of verification: AWS IoT Core enforces a maximum MQTT message size of 128 KB, and Sparkplug encodes every metric of a node into one protobuf payload per message. There is no safe universal tag count, because encoded size depends on the actual metric names, aliases and value types. Measure, then decide.

Inputs: that limit is the documented AWS IoT Core maximum message size; the payload comes from your own encoded Sparkplug output, read from the TRACE log or a captured packet.

Rule: the encoded message, not the JSON you configure, must stay below the broker limit with headroom. Take 80 percent of the limit as the design ceiling:

  • Limit: 128 KB = 131072 bytes
  • Design ceiling: 131072 bytes x 0.8 = 104857 bytes, about 102 KB
  • Suppose your measured NDATA payload at full tag density is 120000 bytes: 120000 bytes is above 104857 bytes but below 131072 bytes, so it connects today and has only about 11 KB of margin.

Decision: below the 102 KB ceiling, publish as one message. Above it, split the tags across two edge nodes (or trim dead metrics) so each stays under the ceiling; a payload near the broker limit will fail the moment tag density grows. Related behavior of Sparkplug publish timing is covered in why Sparkplug B sends DBIRTH once and DDATA on change.

What each observation proves #

Observation What it establishes What it leaves open
Engine connects and publishes with the certificate Credentials authorize at least the Engine workflow Sparkplug topics and retained publishes
Another MQTT client works with the same client ID Client ID and certificate are valid for the tested operations Subscriptions and retained publishes
Transmission connects, then loses connection Failure occurs after session establishment Which action or topic is denied
NDATA topic inside an allowed subtopic That one data path may pass NCMD and retained publishes
RetainPublish enabled, failure unchanged RetainPublish was not the only gap Remaining denied resources in the trace

Questions asked

Why does MQTT Engine connect while MQTT Transmission fails?

MQTT Engine can filter custom namespaces or run without Sparkplug processing, so its publishes fit a namespace-scoped policy. MQTT Transmission only publishes under the spBv1.0 root and issues Sparkplug-required subscriptions such as NCMD and retained publishes, which that policy never allows.

Where do I see which topic IoT Core is denying?

Set the TahuClient logger to TRACE in Ignition; it shows the exact subscriptions and publishes issued during a Transmission connection attempt. Correlate that timestamp with the AWS IoT Core logs to read the denied action and resource instead of the generic connection-lost message.

Can I script publishes through MQTT Engine instead?

Transmission supports scripting publishes too, but Engine scripting was never measured under thousands of tags. If your policy cannot accommodate the spBv1.0 namespace, benchmark a scripted design at your real tag count and update rate before calling it production.

Keep reading

  • Troubleshooting

    PLC ping works but AWS IoT Core MQTT fails when the clock is wrong

    Check the controller clock first. Ping and DNS prove IP reachability only; with the PLC clock set to 2007, TLS rejects every current AWS IoT Core certificate as not yet valid and the handshake dies before MQTT CONNECT, which is why the same project works in simulation on the PC's clock. Connect the clock battery, set the time, enable the NTP client against a plant time server, then retest DNS, port 8883, TLS, CONNACK and publish.

    Edge computing and IIoT

  • How-to

    Bridge a cellular tracker's TCP stream into MQTT for AWS IoT Core

    Build a small ingest service on your edge PC: it terminates the tracker's raw TCP session, decodes each stored record, and republishes one MQTT message per fix over TLS on port 8883. Acknowledge a packet only after every publish is confirmed, or a coverage-gap batch is silently lost.

    Edge computing and IIoT

  • Troubleshooting

    Why an MQTT Engine UDT instance shows up as a folder

    Stop MQTT Transmission on the Edge gateway, delete the affected tags and UDT definitions from MQTT Engine, re-enable Transmission and force the refresh; Engine then rebuilds the objects as UDT instances. On the 4.0.10 builds, upgrade both MQTT modules to 4.0.16 afterwards and restart the Ignition service to clear leaked TransmissionClient threads.

    Edge computing and IIoT

Why MQTT over port 443 to a cloud needs ALPN