Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions documents/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*__Jump To:__*
* [Where should I start](#where-should-i-start)
* [How do I enable logging](#how-do-i-enable-logging)
* [How do I get more information from an error code?](#how-do-i-get-more-information-from-an-error-code)
* [I keep getting AWS_ERROR_MQTT_UNEXPECTED_HANGUP](#i-keep-getting-aws_error_mqtt_unexpected_hangup)
* [How do debug in VSCode?](#how-do-debug-in-vscode)
* [What certificates do I need?](#what-certificates-do-i-need)
Expand All @@ -23,6 +24,20 @@ io.enable_logging(level);
```
You can also enable [CloudWatch logging](https://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html) for IoT which will provide you with additional information that is not available on the client side sdk.

### How do I get more information from an error code?

When you encounter an error code, you can get the human-readable error message using the `error_code_to_string()` function:

``` js
import {io} from "aws-iot-device-sdk-v2";

// Convert error code to readable message
const errorMessage = io.error_code_to_string(errorCode);
console.log(`Error: ${errorMessage}`);
```

This will convert numeric error codes into descriptive error messages that can help you understand what went wrong.

### I keep getting AWS_ERROR_MQTT_UNEXPECTED_HANGUP

This could be many different things but it most likely is a policy issue. Start with using a super permissive IAM policy called AWSIOTFullAccess which looks like this:
Expand Down