mqtt-cli
mqtt-cli copied to clipboard
Cannot connect to AWS IoT core: "Exception while decoding CONNACK: remaining length too short"
Expected behavior
Connected to the AWS IoT Core and subscribed to the topic.
Actual behavior
Connection fails. The following output is provided:
Client '[email protected]' sending CONNECT MqttConnect{keepAlive=60, cleanStart=true, sessionExpiryInterval=0}
Client '[email protected]' DISCONNECTED Exception while decoding CONNACK: remaining length too short
Exception while decoding CONNACK: remaining length too short
To Reproduce
Steps
Run from the terminal:
mqtt-cli.exe subscribe --topic "#" --showTopics --host private-endpoint.us-east-1.amazonaws.com --port 8883 --secure --cert certificate.pem.crt --key private.pem.key --verbose --debug
Reproducer code
Details
- Affected MQTT CLI version(s):
- Used JVM version:
4.5.1
Picocli 4.5.0
JVM: 14 (Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 14+36-1461)
OS: Windows 10 10.0 amd64
Workaround
Add switch to MQTT 3 and set QOS to 0 by adding the following parameters: '--mqttVersion 3 --qos 0'
For example: mqtt-cli.exe subscribe --topic "#" --showTopics --host private-endpoint.us-east-1.amazonaws.com --port 8883 --secure --cert certificate.pem.crt --key private.pem.key --verbose --debug --mqttVersion 3 --qos 0