-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS IoT MQTT Client Error Handling Improvement Needed #543
Comments
To the best of my knowledge, much of what you're asking for isn't possible and/or would not be a good idea to attempt (for example, trying to parse the underlying errors for reasons). The browser SDK is a thin wrapper (adding websocket signing) around mqtt-js, using browser websocket APIs for connection establishment. The SDK does not have access to most of the information you're asking for; all we can do is relay the exception from the layer beneath. For example, browsers do not provide any way to query the http response (http code or response body) to the websocket upgrade, which means we have almost no ability to analyze why a connection attempt failed. A few suggestions:
If you have detailed suggestions about how to give better error information (maybe there are places in the codebase where we drop useful information), we'd be happy to look into them, but the current philosophy is "all we can do is report what the underlying layer told us." |
I'm encountering an issue when trying to connect to AWS IoT via WebSocket. The connection attempt fails with the following error message: Error occurs in stream.js |
Describe the bug
The MQTT client error handler in our application is not providing sufficient error type information when connection issues occur, particularly with WebSocket connections and credential expiration. This makes it difficult to implement proper error handling and recovery strategies.
const currentCredentials = await Auth.currentCredentials();
const clientId =
guffo-${Math.floor(Math.random() * 100000 + 1)}-${Date.now()}
;So when I try to catch errors with this code
Expected Behavior
The error handler should:
Current Behavior
Currently, when connection issues occur:
error
event handler receives a generic error object without specific error type informationReproduction Steps
Initiate an MQTT websocket connection using cognito and wait for the connection to close on error.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
SDK Version: aws-iot-device-sdk-js-v2 1.17.0
Environment details (OS name and version, etc.)
Platform: Browser (React application)
The text was updated successfully, but these errors were encountered: