Skip to content

MQTT Bridge deploys successfully but does not relay.

0

The MQTT Bridge is configure to relay from the local mosquitto broker to IoT Core. Deployment is successful but nothing is showing in the IoT Test Client. Only successful deployment information is showing in the log file, no additional information from runtime errors from the Bridge component.

greengrasss/v2/logs/greengrass.log

What can be done to troubleshoot?

Background Information

deployment.yml with a ThingName prefix

aws.greengrass.clientdevices.mqtt.Bridge:
    componentVersion: '2.3.2'
    configurationUpdate:
      merge: |
        {
          "mqttTopicMapping": {
            "LemaDeviceTopics":{
              "topic": "device/v1/device/#",
              "source": "LocalMqtt",
              "target": "IotCore",
              "targetTopicPrefix": "Device_SO2"
            }
          },
          "mqtt": {
            "brokerUri": "tcp://localhost:1883"
          }
        }

The policy document in the JITP provisioning profile includes all of the iot: actions for the topic {iot:Connection.Thing.ThingName}/* and client {iot:Connection.Thing.ThingName}

asked 2 years ago390 views

3 Answers
1

To troubleshoot the MQTT Bridge that's not relaying messages despite a successful deployment, you can try the following steps:

  1. Verify the MQTT bridge configuration: Ensure that the topic mappings in the MQTT bridge component configuration are correct. Double-check that the source and target are properly set (e.g., "LocalMqtt" for source and "IotCore" for target when relaying from local broker to AWS IoT Core).

  2. Check MQTT broker compatibility: Confirm that you're using a compatible MQTT broker. It's recommended to use only one MQTT broker component, as the MQTT bridge works with only one broker at a time.

  3. Review core device AWS IoT policy: Ensure that the core device's AWS IoT policy allows the necessary permissions for publishing and subscribing to the relevant topics.

  4. Examine component logs: While you mentioned that nothing is logged in greengrass.log, it's worth double-checking the logs for any subtle indications of issues. Look for entries related to the MQTT bridge component.

  5. Test with simple topic mappings: Try configuring a simple, straightforward topic mapping to test if the bridge is functioning at all.

  6. Verify client device connectivity: Ensure that your client devices are successfully connecting to the local MQTT broker on the core device.

  7. Check QoS settings: Remember that the MQTT bridge uses QoS 1 for publishing and subscribing to AWS IoT Core, even if client devices use QoS 0 locally. This might introduce some latency.

  8. Inspect network connectivity: Verify that the core device has a stable internet connection to communicate with AWS IoT Core.

  9. Review other component configurations: Check the configurations of related components like the client device auth, IP detector, and MQTT broker to ensure they're set up correctly.

  10. Use AWS IoT Core MQTT test client: Try publishing a message from AWS IoT Core to a topic that should be relayed to the local broker, and see if it reaches the local devices. This can help determine if the issue is with inbound or outbound relay.

If these steps don't resolve the issue, you may need to enable more verbose logging or contact AWS support for further assistance.
Sources
Relay MQTT messages between client devices and AWS IoT Core - AWS IoT Greengrass
Set up and troubleshoot AWS IoT Greengrass with client devices - AWS Prescriptive Guidance
Choose an MQTT broker - AWS IoT Greengrass
MQTT bridge - AWS IoT Greengrass

answered 2 years ago

0

MQTT bridge component - https://docs.aws.amazon.com/greengrass/v2/developerguide/mqtt-bridge-component.html. Intially, we need to understand the source and target configuration settings [1]. As you can see from the target settings, there are three message broker options:

  1. LocalMqtt – The local MQTT broker where client devices communicate.
  2. Pubsub – The local Greengrass publish/subscribe message broker.
  3. IotCore – The AWS IoT Core MQTT message broker.

If you wants to inspect messages on the MQTT test client, it means you are publishing to AWS IoT Core. In this case, the target configuration should be set to IotCore.

However, if you are publishing to a local message broker or the Greengrass core itself, we would not expect those messages to show up in the MQTT test client.

If further troubleshooting is required, you can raise a support ticket and share the complete logs, i.e, zipped log folder and the config folder for analysis.

[1] MQTT bridge - Configuration - https://docs.aws.amazon.com/greengrass/v2/developerguide/mqtt-bridge-component.html#mqtt-bridge-component-configuration [2] https://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html

AWS

answered 2 years ago

0

Hello, Greengrass does support bringing your own broker, however, it is generally recommended to use the Greengrass provided Moquette or EMQX brokers that already implement authentication and authorization. To bridge messages to IoT Core when using your own MQTT Broker, please find the following workshop as an example: https://catalog.us-east-1.prod.workshops.aws/workshops/5ecc2416-f956-4273-b729-d0d30556013f/en-US/chapter6-mqtt-broker/20-step1

AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.