Skip to content
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

MQTT Connection Closed #503

Closed
TusharBudhirajaDev opened this issue May 30, 2024 · 4 comments
Closed

MQTT Connection Closed #503

TusharBudhirajaDev opened this issue May 30, 2024 · 4 comments
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 5 days unless further comments are made. p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days.

Comments

@TusharBudhirajaDev
Copy link

Describe the bug

Hey I am using aws-iot-device-sdk-v2 in my Angular application on frontend side, I create a client using this sdk, so while using this my client create using following parameters:

  1. accessKeyId
  2. secretKey
  3. host
  4. clientId
  5. region
  6. sessionToken

My client has been created successfully, and my connect event is working fine but before message event is called, I get an error of connection close like this

Error: Error: Connection closed
at new CrtError (error.js:34:1)
at MqttClientConnection._this.on_error (mqtt.js:271:1)
at mqtt.js:475:1
at Object.cb (client.js:831:1)
at client.js:198:1
at Array.forEach ()
at flushVolatile (client.js:196:1)
at Duplexify. (client.js:469:1)
at Duplexify.emit (events.js:153:1)
at push.+xLd.Duplexify._destroy (index.js:199:1)errorr...... Error: Error: Connection closed
at new CrtError (error.js:34:1)
at MqttClientConnection._this.on_error (mqtt.js:271:1)
at mqtt.js:475:1
at Object.cb (client.js:831:1)
at client.js:198:1
at Array.forEach ()
at flushVolatile (client.js:196:1)
at Duplexify. (client.js:469:1)
at Duplexify.emit (events.js:153:1)
at push.+xLd.Duplexify._destroy (index.js:199:1)

Expected Behavior

My message event should be working according to documentation given by aws

Current Behavior

Throwing error

Error: Error: Connection closed
at new CrtError (error.js:34:1)
at MqttClientConnection._this.on_error (mqtt.js:271:1)
at mqtt.js:475:1
at Object.cb (client.js:831:1)
at client.js:198:1
at Array.forEach ()
at flushVolatile (client.js:196:1)
at Duplexify. (client.js:469:1)
at Duplexify.emit (events.js:153:1)
at push.+xLd.Duplexify._destroy (index.js:199:1)errorr...... Error: Error: Connection closed
at new CrtError (error.js:34:1)
at MqttClientConnection._this.on_error (mqtt.js:271:1)
at mqtt.js:475:1
at Object.cb (client.js:831:1)
at client.js:198:1
at Array.forEach ()
at flushVolatile (client.js:196:1)
at Duplexify. (client.js:469:1)
at Duplexify.emit (events.js:153:1)
at push.+xLd.Duplexify._destroy (index.js:199:1)

Reproduction Steps

const client = this.getClient(iotInput);
let counter = 0;

    client.on('connect', () => {
        console.log('$$$', iotInput);

        client.subscribe(iotInput.topic, 1);
        iotInput.connectionSuccessCallback();
        console.log('connecting......');
    });

    client.on('message', (topic, message) => {
        const data = new TextDecoder('utf-8').decode(message);
        console.log('message......', data);
       }

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.16.1

Environment details (OS name and version, etc.)

facing issue on both window and mac(ios) as well

@TusharBudhirajaDev TusharBudhirajaDev added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 30, 2024
@bretambrose
Copy link
Contributor

Please provide full, minimal standalone repro. The code snippet is insufficient.

In general, a reliable connection closed behavior is usually due to incorrect permissions on the IAM policy that is associated with the credentials used to establish the websocket connection. What is the policy you are using?

@jmklix jmklix added p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days. and removed needs-triage This issue or PR still needs to be triaged. labels May 30, 2024
Copy link

github-actions bot commented Jun 9, 2024

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 5 days unless further comments are made. label Jun 9, 2024
@TusharBudhirajaDev
Copy link
Author

This issues has been debugged, Its a IAM policy. Thanks for helping

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 5 days unless further comments are made. p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 2 days.
Projects
None yet
Development

No branches or pull requests

3 participants