message='The connection was closed unexpectedly.', code=5134 region us-west-1

See original GitHub issue

Confirm by changing [ ] to [x] below to ensure that it’s a bug:

Known Issue

  • I’m using ATS data type endpoint: the endpoint should look like <prefix>-ats.iot.<region>.amazonaws.com xxxxxxxxx-ats.iot.us-west-1.amazonaws.com

Describe the bug Went through “Getting Started - and Register Device” Got cert, private key, public key and CA

SDK version number 2 (python3)

Platform/OS/Device What are you running the sdk on? Ubuntu

To Reproduce (observed behavior) Steps to reproduce the behavior (please share code) Simple pub/sub sample python3 pubsub.py --endpoint xxxxxxxxxx-ats.iot.us-west-1.amazonaws.com --root-ca root-CA.crt --cert zztest.cert.pem --key zztest.private.key --verbosity Debug

[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [task-scheduler] - id=0x7fc744013750: Scheduling socket_handler_close task for immediate execution
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [task-scheduler] - id=0x7fc7440021b0: Running epoll_event_loop_unsubscribe_cleanup task with <Running> status
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [task-scheduler] - id=0x7fc744013750: Running socket_handler_close task with <Running> status
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel] - id=0x7fc744002770: handler 0x7fc7440136b0 shutdown in write dir completed.
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [task-scheduler] - id=0x7fc744002798: Scheduling (null) task for immediate execution
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [task-scheduler] - id=0x7fc744002798: Running (null) task with <Running> status
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel] - id=0x7fc744002770: during shutdown, canceling task 0x7fc744013920
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [task-scheduler] - id=0x7fc744013920: Running tls_timeout task with <Canceled> status
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel] - id=0x7fc744002770: during shutdown, canceling task 0x7fc74402de40
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [task-scheduler] - id=0x7fc74402de40: Running mqtt_connack_timeout task with <Canceled> status
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel-bootstrap] - id=0x10f7550: channel 0x7fc744002770 shutdown with error 0.
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel] - id=0x7fc744002770: destroying channel.
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75343a700] [channel-bootstrap] - id=0x10f7550: releasing bootstrap reference
Traceback (most recent call last):
  File "pubsub.py", line 130, in <module>
    connect_future.result()
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
awscrt.exceptions.AwsCrtError: AwsCrtError(name='AWS_ERROR_MQTT_UNEXPECTED_HANGUP', message='The connection was closed unexpectedly.', code=5134)
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: user called disconnect.
[ERROR] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: Connection is not open, and may not be closed
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: Last refcount on connection has been released, start destroying the connection.
[DEBUG] [2021-02-01T06:03:41Z] [00007fc75814b740] [mqtt-client] - id=0x12fbb80: Destroying connection

Expected behavior A clear and concise description of what you expected to happen. messages continually published

Logs/output If applicable, add logs or error output.

REMEMBER TO SANITIZE YOUR PERSONAL INFO

awscrt.io.init_logging(awscrt.io.LogLevel.Warn, 'stderr')

Additional context Add any other context about the problem here.

This seems a little silly and confusing … image Why are there 2 different things called IoT Core in the management console ? I’m currently working in us-west-1 (N. California) region … It says for one of them IoT Core is not supported - then If I click the other icon it says that it is, can you explain ? image

and here is the one that does work in us-west-1 image Or does it not work ? is that the root problem … it works but doesn’t work … 😛

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
hackaprendecommented, Feb 18, 2021

I feel so dumb right now, the error for me was that I had not activated the certificate in the IoT console. This is something stupid but could help others

1reaction
wes-novackcommented, Apr 4, 2021

Posting here in case this helps any future searchers, I was also getting the error awscrt.exceptions.AwsCrtError: AWS_ERROR_MQTT_UNEXPECTED_HANGUP: The connection was closed unexpectedly. and for me, it turns out that I had not activated the AWS IoT thing certificate. After creating it, there’s another step to activate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using awsiotsdk when subscribing to a topic with QoS ...
The above code works, I can later publish and receive the message successfully. However if I change the QoS to EXACTLY_ONCE I get...
Read more >
Diagnosing connectivity issues - AWS IoT Core
All publish/subscribe operations are denied by default. Make sure the attached policy authorizes the actions you are trying to perform.
Read more >
Error Codes and Descriptions - Travelport
Two or more booking travelers cannot have the same name. 6214, All the Requested E-Tickets not found. Please do a Air Retrieve Document...
Read more >
Solved: HTTP error "The connection was closed unexpectedly...
Http request failed with status code 'ConnectionClosed' and status message: 'The underlying connection was closed: The connection was closed ...
Read more >
CICS TS for z/OS: CICS Messages - IBM
region, or the connection could not be closed for some other reason. The reason code indicates which validity check failed within procedure AXMSCCLS....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found