'ESP32 AWS IoT transportStatus=-1

I'm following the espressif docs for connecting a ESP32 to AWS IoT shadow. I'm using the example github.com/espressif/esp-aws-iot for shadow mqtt synchronisation. I set everything in the config but when I run it on the ESP32, I get the following error:

--- until here everything runs fine ---
--- mqtt connects to aws and it's success ---
--- and then ---
I coreMQTT: SUBSCRIBE topic $aws/things/MY_DEVICE_NAME/shadow/name/MY_SHADOW_NAME/delete/accepted to broker.
E coreMQTT: A single byte was not read from the transport: transportStatus=-1.
E coreMQTT: Receiving incoming packet length failed. Status=MQTTRecvFailed
E coreMQTT: Exiting process loop due to failure: ErrorStatus=MQTTRecvFailed
E coreMQTT: MQTT_ProcessLoop returned with status = 4.

I tried increasing the network buffer for MQTT packets via the config to 4096 but that didn't help. Anyone know what the problem might be?



Solution 1:[1]

I found the error. Something was messed up with the policy I created for that device. I'm still not 100% sure what exactly was the problem, but when I removed the code that tried to delete the shadow first before the actual shadow operations begin, the example worked fine. I can now pub/sub to my shadow.

For anyone having the same problem, comment the code from line 691-746 (part for deletion).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gxor