Troubleshooting
Why MQTT Transmission fails when MQTT Engine connects to AWS IoT Core
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
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 #
- Set the Ignition
TahuClientlogger to TRACE and let Transmission attempt one connection. The trace lists every publish and subscription topic it issues. - Correlate that timestamp with the AWS IoT Core logs and record the exact denied action and resource for each
authentication_failure. - Attach a policy to the certificate that allows, on topic ARNs,
iot:Connectfor the client ID,iot:Publishandiot:SubscribeonspBv1.0/...resources,iot:Receive, and the retained-publish permission for everyspBv1.0publish resource. Enabling RetainPublish alone does not fix it; every traced resource must be allowed. - Reconnect Transmission and confirm it stays online instead of re-entering the 1000-millisecond retry cycle.
- Confirm the full chain: the session holds, the NCMD subscription is accepted, and data arrives under the expected
spBv1.0topic 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.