aws / amazon-freertos

DEPRECATED - See README.md
https://aws.amazon.com/freertos/
MIT License
2.54k stars 1.1k forks source link

[General] Unable to establish MQTT Connection in greengrass discovery demo #3456

Closed pegasus-automation closed 2 years ago

pegasus-automation commented 2 years ago

greengrass_discovery demo unable to make MQTT connection.

I am trying to run greengrass connectivity demo. With the components as shown in the attached image below. But while running the demo it is unable to make MQTT Connection.

System information

References

MyPi group Components

The image has all the components active in my core device.

Below is the error printed while running the demo code

14 1733 [iot_thread] [aws_greengrass_discovery_demo.c:543] [INFO] [Greengrass_Discovery_Demo] Greengrass device discovered.

15 1733 [iot_thread] [aws_greengrass_discovery_demo.c:435] [INFO] [Greengrass_Discovery_Demo] Creating a TLS connection to 192.168.0.109:8883.

E (18206) PKCS11: failed nvs get file size 4354 0
16 2266 [iot_thread] [core_mqtt.c:1568] [ERROR] [MQTT] CONNACK recv failed with status = MQTTNoDataAvailable.

17 2266 [iot_thread] [core_mqtt.c:1839] [ERROR] [MQTT] MQTT connection failed with status = MQTTNoDataAvailable.

18 2266 [iot_thread] [aws_greengrass_discovery_demo.c:457] [ERROR] [Greengrass_Discovery_Demo] Failed to establish MQTT connection: Server=192.168.0.109

19 2269 [iot_thread] [aws_greengrass_discovery_demo.c:435] [INFO] [Greengrass_Discovery_Demo] Creating a TLS connection to 192.168.0.109:8883.

E (23506) PKCS11: failed nvs get file size 4354 0
20 2795 [iot_thread] [core_mqtt.c:1568] [ERROR] [MQTT] CONNACK recv failed with status = MQTTNoDataAvailable.

21 2795 [iot_thread] [core_mqtt.c:1839] [ERROR] [MQTT] MQTT connection failed with status = MQTTNoDataAvailable.

22 2795 [iot_thread] [aws_greengrass_discovery_demo.c:457] [ERROR] [Greengrass_Discovery_Demo] Failed to establish MQTT connection: Server=192.168.0.109

23 2817 [iot_thread] [aws_greengrass_discovery_demo.c:435] [INFO] [Greengrass_Discovery_Demo] Creating a TLS connection to 192.168.0.109:8883.

E (28926) PKCS11: failed nvs get file size 4354 0
24 3330 [iot_thread] [core_mqtt.c:1568] [ERROR] [MQTT] CONNACK recv failed with status = MQTTNoDataAvailable.

25 3330 [iot_thread] [core_mqtt.c:1839] [ERROR] [MQTT] MQTT connection failed with status = MQTTNoDataAvailable.

26 3330 [iot_thread] [aws_greengrass_discovery_demo.c:457] [ERROR] [Greengrass_Discovery_Demo] Failed to establish MQTT connection: Server=192.168.0.109

27 3335 [iot_thread] [aws_greengrass_discovery_demo.c:435] [INFO] [Greengrass_Discovery_Demo] Creating a TLS connection to 192.168.0.109:8883.

E (34156) PKCS11: failed nvs get file size 4354 0
28 3852 [iot_thread] [core_mqtt.c:1568] [ERROR] [MQTT] CONNACK recv failed with status = MQTTNoDataAvailable.

29 3852 [iot_thread] [core_mqtt.c:1839] [ERROR] [MQTT] MQTT connection failed with status = MQTTNoDataAvailable.

30 3852 [iot_thread] [aws_greengrass_discovery_demo.c:457] [ERROR] [Greengrass_Discovery_Demo] Failed to establish MQTT connection: Server=192.168.0.109

31 4113 [iot_thread] [aws_greengrass_discovery_demo.c:435] [INFO] [Greengrass_Discovery_Demo] Creating a TLS connection to 192.168.0.109:8883.

E (41936) PKCS11: failed nvs get file size 4354 0
32 4632 [iot_thread] [core_mqtt.c:1568] [ERROR] [MQTT] CONNACK recv failed with status = MQTTNoDataAvailable.

33 4632 [iot_thread] [core_mqtt.c:1839] [ERROR] [MQTT] MQTT connection failed with status = MQTTNoDataAvailable.
muneebahmed10 commented 2 years ago

Hi @pegasus-automation,

It looks like the core is discovered but the MQTT connection is unable to be established. Have you configured your device with sufficient permissions, as described here? You might be missing a statement like

{
      "Effect": "Allow",
      "Action": [
        "greengrass:*"
      ],
      "Resource": "*"
}

for Greengrass or a similar one for IoT in your device's policy

pegasus-automation commented 2 years ago

Yes this permission is given in the policy @muneebahmed10

n9wxu commented 2 years ago

Can you review this document and make sure the "Client device auth" component is configured? https://docs.aws.amazon.com/greengrass/v2/developerguide/client-devices-tutorial.html#enable-client-device-support

pegasus-automation commented 2 years ago

@n9wxu as you can see in the image attached the "client device auth" is running.

jbutler commented 2 years ago

@pegasus-automation you still need to configure the component. Simply deploying it is not enough. I'd suggest going through the tutorial. It's very likely you're missing something that will be outlined there.

aggarg commented 2 years ago

Are you still facing this issue?

pvyawaha commented 2 years ago

Hello @pegasus-automation , I am closing this issue now, please reopen on the same topic or create a new one for other.