- Newest
- Most votes
- Most comments
Your device does not provide the clientId when connecting, while the clientId is visible in the Linux connection log.
Review your firmware and add the clientId when you establish the MQTT connectivity.
answered a year ago
To debug the MQTT connection issue with your embedded device, there are several steps you can take:
-
Verify the endpoint: Double-check that you're using the correct AWS IoT Core endpoint. You can obtain this using the AWS CLI command: aws iot describe-endpoint --endpoint-type iot:Data-ATS. Ensure the endpoint includes "-ats" in the URL.
-
Certificate and key verification: Confirm that the device certificate, private key, and root CA certificate are correctly configured on your embedded device. Make sure you're using the Amazon Root CA 1 certificate for AWS IoT Core.
-
Policy permissions: Review the IoT policy attached to your device certificate. It should allow iot:Connect, iot:Publish, iot:Subscribe, and iot:Receive for the required topics.
-
Time synchronization: Ensure your embedded device has accurate time synchronization. TLS handshakes require correct time settings.
-
TLS version: Verify that your embedded device supports and is configured to use TLS 1.2 or later, as required by AWS IoT Core.
-
Memory and buffer sizes: Check if your embedded device has sufficient memory allocated for the MQTT client and TLS operations. Increase buffer sizes if necessary.
-
Network stability: Verify the network connection on your embedded device is stable and can reach the AWS IoT Core endpoint.
-
Enable verbose logging: If possible, enable more detailed logging on your embedded device's MQTT client library to get more information about the connection attempt.
-
Use AWS Device Advisor: This tool can help diagnose connectivity issues between your device and AWS IoT Core by running specific tests.
-
Consider MQTT over WebSocket: If you continue to face issues, try using MQTT over WebSocket (port 443) as it can bypass certain port restrictions.
-
Check SDK and dependencies: Ensure you're using the latest version of the AWS IoT Device SDK and that all dependencies are up to date.
If you still can't identify the issue, you may need to implement more granular error reporting in your embedded device code to pinpoint where exactly the connection is failing. This could involve adding debug statements at various stages of the connection process.
Remember that while CloudWatch and Device Advisor are helpful, they may not capture all failure scenarios, especially if the connection isn't being established in the first place. Focus on gathering more detailed logs from your embedded device itself to get a clearer picture of what's happening during the connection attempt.
Sources
ESP32 Fails to Connect to AWS IoT Core via MQTT (TLS Handshake Error) | AWS re:Post
Issue: AWS IoT MQTT Test Client stuck at "Fetching client endpoint" | AWS re:Post
answered a year ago
I’ve captured logs from CloudWatch, and while all event types are visible when the device connects successfully, the logs don’t provide any specific reason when the connection to MQTT fails. Could you please guide me on where to find detailed logs or diagnostics in AWS IoT Core that explain the cause of connection failures?
answered a year ago
Ensure that your AWS IoT Core logs are set to the DEBUG level.
Please share the exact mosquitto invocation and the firmware MQTT code snippet.
Typical reasons for MQTT connectivity issues are incorrect (or omitted) Client ID and TLS configuration.
answered a year ago
I enabled the debug log level and captured the failure log from CloudWatch, as shown in the attached screenshot which is tested with my embedded device.
However, when I tested the same MQTT credentials on my Linux PCusing some application, the connection was successful. The screenshot of the successful connection is also attached.
Please look into it.
answered a year ago
Relevant content
asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
