message='The connection was closed unexpectedly.', code=5134 region us-west-1
See original GitHub issueConfirm by changing [ ] to [x] below to ensure that it’s a bug:
- I’ve searched for previous similar issues and didn’t find any solution
Known Issue
- I’m using ATS data type endpoint: the endpoint should look like
<prefix>-ats.iot.<region>.amazonaws.comxxxxxxxxx-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 …
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 ?

and here is the one that does work in us-west-1
Or does it not work ? is that the root problem … it works but doesn’t work … 😛
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Related StackOverflow Question
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
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.