espressif / esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
Apache License 2.0
260 stars 156 forks source link

MQTT TLS MUTUAL AUTHENTICATION from example project Having Issues ! (CA-341) #226

Open MahadiHasantauhid opened 3 weeks ago

MahadiHasantauhid commented 3 weeks ago

E (916849) coreMQTT: A single byte was not read from the transport: transportStatus=-1. E (916849) coreMQTT: CONNACK recv failed with status = MQTTRecvFailed. E (916859) coreMQTT: MQTT connection failed with status = MQTTRecvFailed. E (916859) coreMQTT: Connection with MQTT broker failed with status MQTTRecvFailed. E (916869) coreMQTT: Connection to the broker failed, all attempts exhausted. E (916879) coreMQTT: Failed to connect to MQTT broker a2ymunmj15xks7-ats.iot.ap-south-1.amazonaws.com. The issues above I'm not sure what is causing this. I have successfully flash the ESP32-C3-MINI with example project.

MahadiHasantauhid commented 3 weeks ago

I think the issues are connected to AWS Policy making. I managed to solve that partially. while having this latest error below E (4855244) coreMQTT: Call to receiveSingleIteration failed. Status=MQTTRecvFailed E (4855244) coreMQTT: MQTT_ProcessLoop failed to receive ACK packet: Expected ACK Packet ID=2e9, LoopDuration=76, Status=MQTTRecvFailed In my policy the Resource for Both Publish and Receive are similar arn:aws:iot:ap-south-1:Account Id:topic/example/topic I would like to know, In the code we all have "example/topic" for both publish and subscribe, then how to set "Policy Resource" for Policy action "iot:Receive"? or should we just deny Receive as policy action to get similar message log mentioned in TLS Mutual Authentication in Readme.md file. thank you in advance.

MahadiHasantauhid commented 2 weeks ago

I found the problem and solved it. The problem in my case was "Client ID" not being set according to "iot:connect" policy action. while creating the policy action "iot:connect" we are also setting the "Client ID". The same ID needs to be used in "idf.py menuconfig".