Azure/azure-iot-cli-extension

event hub monitor issue

mheskandari opened this issue · 6 comments

This is autogenerated. Please review and update as needed.

Describe the bug

I have a monitor that I check my iothub devices events that recently show up this error
Command Name
az iot hub monitor-events Extension Name: azure-iot. Version: 0.10.17.

Errors:

The command failed with an unexpected error. Here is the traceback:
cannot import name 'c_uamqp' from partially initialized module 'uamqp' (most likely due to a circular import) (C:\Users\mheskandari\.azure\cliextensions\azure-iot\uamqp\__init__.py)
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "C:\Users\mheskandari\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 2940, in iot_hub_monitor_events
    _iot_hub_monitor_events(
  File "C:\Users\mheskandari\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 3053, in _iot_hub_monitor_events
    from azext_iot.monitor.builders import hub_target_builder
  File "C:\Users\mheskandari\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 8, in <module>
    import uamqp
  File "C:\Users\mheskandari\.azure\cliextensions\azure-iot\uamqp\__init__.py", line 12, in <module>
    from uamqp import c_uamqp  # pylint: disable=import-self
ImportError: cannot import name 'c_uamqp' from partially initialized module 'uamqp' (most likely due to a circular import) (C:\Users\mheskandari\.azure\cliextensions\azure-iot\uamqp\__init__.py)

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az iot hub monitor-events --resource-group {} -n {} --props {} --subscription {} --cg {}

Expected Behavior

Environment Summary

Windows-10-10.0.19044-SP0
Python 3.10.5
Installer: MSI

azure-cli 2.40.0

Extensions:
azure-iot 0.10.17

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Thanks for submitting an issue, @mheskandari. I noticed your issue contains the following error:

ImportError: cannot import name 'c_uamqp' from partially initialized module 'uamqp'
which can often be solved quickly by either:

  • Updating your installed version of the azure-iot extension:
    az extension update --name azure-iot
  • Performing a repair of the uamqp dependency:
    az iot hub monitor-events --hub-name {} --device-id {} --repair

Please try these two resolution methods and see if that helps resolve your issue.

Same issue with cloud shell 2.40 and iot extension 0.17.1.

Isse for uamqp 1.2.

@aleschmidt93 have you tried the mitigation posted by the msftbot namely using --repair to re-install uamqp?

@digimaun Yes, but without any effect. I also deleted the cloud shell storage and created a new one from stretch.
I also opened a case in azure but the support only "escalated this issue to the iot hub team for further investigation" 12 days ago...

@aleschmidt93 this issue was resolved via support request right? Looking to close the issue.

Closing due to inactivity.