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

AwsCrtError: AWS_ERROR_MQTT_UNEXPECTED_HANGUP #16

Open
GoldSnake2100 opened this issue Apr 23, 2021 · 2 comments
Open

AwsCrtError: AWS_ERROR_MQTT_UNEXPECTED_HANGUP #16

GoldSnake2100 opened this issue Apr 23, 2021 · 2 comments

Comments

@GoldSnake2100
Copy link

I clone this repo on my jetson nano board, and successfully install dependencies.
I checked openssl connection to my iot endpoint, and it also success.
But when I run python3 main.py I get this error

Traceback (most recent call last):
  File "main.py", line 81, in <module>
    run_provisioning(isRotation=False)
  File "main.py", line 74, in run_provisioning
    provisioner.get_official_certs(callback)
  File "/home/li/IOT/aws-iot-fleet-provisioning/provisioning_handler.py", line 161, in get_official_certs
    return asyncio.run(self.orchestrate_provisioning_flow(callback))
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/home/li/IOT/aws-iot-fleet-provisioning/provisioning_handler.py", line 165, in orchestrate_provisioning_flow
    self.core_connect()
  File "/home/li/IOT/aws-iot-fleet-provisioning/provisioning_handler.py", line 102, in core_connect
    connect_future.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/usr/lib/python3.7/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)

I checked policy as well, and it looks correct.

@RaleighSF
Copy link
Contributor

@GoldSnake2100 - I've seen this when the policy wasn't attached to the certificate. If this is the error you are getting from running the script for the first time using your bootstrap certificate, check and make sure that the certificate has a policy attached. (Secure->Certificates->[select YOUR certificate] then Policies->attach policy (if you don't see one currently attached).

@GoldSnake2100
Copy link
Author

GoldSnake2100 commented Apr 24, 2021

I got the same error when I use correct IOT endpoint.

INFO:provisioning_handler:##### SUCCESS. SAVING KEYS TO DEVICE! #####
##### SUCCESS. SAVING KEYS TO DEVICE! #####
INFO:provisioning_handler:##### CREATING THING ACTIVATING CERT #####
##### CREATING THING ACTIVATING CERT #####
Received message from topic '$aws/provisioning-templates/InspiredIOT/provision/json/accepted': b'{"deviceConfigurnspired_1619188237731"}'
INFO:provisioning_handler:##### CERT ACTIVATED AND THING OarInspired_1619188237731 CREATED #####
##### CERT ACTIVATED AND THING OarInspired_1619188237731 CREATED #####
INFO:provisioning_handler:##### CONNECTING WITH OFFICIAL CERT #####
##### CONNECTING WITH OFFICIAL CERT #####
Connecting with Prod certs to a3s5zausxvmnat-ats.iot.ap-southeast-2.amazonaws.com with client ID '1619188237731-P
Exception ignored in: <class 'awscrt.exceptions.AwsCrtError'>
Traceback (most recent call last):
  File "/home/li/.local/lib/python3.7/site-packages/awscrt/mqtt.py", line 477, in callback_wrapper
    callback(topic=topic, payload=payload)
  File "/home/li/IOT/aws-iot-fleet-provisioning/provisioning_handler.py", line 313, in basic_callback
    self.on_message_callback(payload)
  File "/home/li/IOT/aws-iot-fleet-provisioning/provisioning_handler.py", line 211, in on_message_callback
    self.validate_certs()
  File "/home/li/IOT/aws-iot-fleet-provisioning/provisioning_handler.py", line 284, in validate_certs
    self.cert_validation_test()
  File "/home/li/IOT/aws-iot-fleet-provisioning/provisioning_handler.py", line 307, in cert_validation_test
    connect_future.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/usr/lib/python3.7/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 c5134)

So I checked CloudWatch log, it looks like this.

2021-04-23 14:25:13.717 TRACEID:3d744f10-f5c7-64ca-f0cf-bde767f4ded6 PRINCIPALID:OarInspired_1619186069832 [ERROR] EVENT:GetThingShadow THINGNAME:OarInspired_1619186069832 ERRORCODE:404 MESSAGE:No shadow exists with name: 'OarInspired_1619186069832'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants