Azure / azure-iot-sdk-python

A Python SDK for connecting devices to Microsoft Azure IoT services
MIT License
423 stars 377 forks source link

Get "Environment IOTEDGE_AUTHSCHEME not set" error #187

Closed alwarmb-bosch closed 6 years ago

alwarmb-bosch commented 6 years ago

I am deploying a Python module along with a .netcore module on a raspberry pi 3 b+ with Raspbian OS. In this case the raspberry pi acts as an IoT edge device.

The .netcore module starts without any problem. But I get the following error on the Python module. It fails to start.

Python Azure IoT Edge Module. Press Ctrl-C to exit.
Error: Time:Fri Aug 24 22:18:00 2018 File:/usr/sdk/src/c/iothub_client/src/iothub_client_ll_edge.c Func:retrieve_edge_environment_variabes Line:51 Environment IOTEDGE_AUTHSCHEME not set
Error: Time:Fri Aug 24 22:18:00 2018 File:/usr/sdk/src/c/iothub_client/src/iothub_client_ll_edge.c Func:IoTHubModuleClient_LL_CreateFromEnvironment Line:117 retrieve_edge_environment_variabes failed
Error: Time:Fri Aug 24 22:18:00 2018 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core.c Func:create_iothub_instance Line:928 Failure creating iothub handle
Unexpected error IoTHubClient.create_from_environment, IoTHubClientResult.ERROR from IoTHub

I also inspected the docker container for the environment variables. As you can see below IOTEDGE_AUTHSCHEME variable is present and has a value sasToken.

"Env": [
                "IOTEDGE_APIVERSION=2018-06-28",
                "RuntimeLogLevel=Information",
                "IOTEDGE_IOTHUBHOSTNAME=xxxxx.azure-devices.net",
                "IOTEDGE_MODULEID=PythonModule",
                "IOTEDGE_GATEWAYHOSTNAME=xxxxx-raspi",
                "IOTEDGE_MODULEGENERATIONID=1236468456",
                "IOTEDGE_WORKLOADURI=unix:///var/run/iotedge/workload.sock",
                "IOTEDGE_DEVICEID=xxxxxx-raspi",
                "IOTEDGE_AUTHSCHEME=sasToken",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "TINI_VERSION=0.14.0",
                "LC_ALL=C.UTF-8",
                "DEBIAN_FRONTEND=noninteractive",
                "UDEV=on",
                "container=docker",
                "LANG=C.UTF-8",
                "PYTHON_VERSION=2.7.15",
                "PYTHON_PIP_VERSION=10.0.1",
                "SETUPTOOLS_VERSION=39.1.0",
                "PYTHONIOENCODING=UTF-8",
                "PYTHON_DBUS_VERSION=1.2.4",
                "PYTHONPATH=/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/site-packages:"
            ],

Note: My Python module is mostly based on the CameraCapture module of the Custom Vision IoT edge solution. https://azure.microsoft.com/en-gb/resources/samples/custom-vision-service-iot-edge-raspberry-pi/ In this sample solution, azure-iothub-device-client==1.4.0 is specified as a requirement. So do I.

pierreca commented 6 years ago

@alwarmb-bosch that's not an error we've been running into.. I wonder if it's an old error in the C SDK that has since then been fixed. would you mind trying with the latest version of the package (1.4.2)?

pierreca commented 6 years ago

@alwarmb-bosch without much more feedback I'm going to close this as inactive. please let us know the results of testing with the latest version of the package and we'll reopen the issue. Thanks!

az-iot-builder-01 commented 6 years ago

@alwarmb-bosch, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey