microsoft / vscode-azure-iot-toolkit

Azure IoT Hub extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit
Other
73 stars 58 forks source link

Failed to list IoT Hub devices Error: Requested Host is not supported ; ArgumentInvalid #543

Open m4rs4t opened 2 years ago

m4rs4t commented 2 years ago

Hello, running the command sudo iotedge list I’m getting a empty list:

iotedge-user@ SEMPER-ULTRA-EFLOW [ ~ ]$ sudo iotedge list
NAME             STATUS           DESCRIPTION      CONFIG

and running sudo iotedge logs SimulatedTemperatureSensor -f I’m getting:

A module runtime error occurred

Visual studio Code too is no more showing the list of devices under IOTHub image

I ran this command: sudo iotedge system logs -- -f And I got a

Hub client error aziot-identityd[1160]: 2022-03-25T08:55:35Z [INFO] - !!! caused by: ErrorCode:ArgumentInvalid;Requested Host is not supported

Additional Info:

How can I find where is the “ArgumentInvalid” to fix the issue? Thank you in advance

Log lines follows (got giving the command sudo iotedge system logs -- -f) :

iotedge-user@SEMPER-ULTRA-EFLOW [ ~ ]$ sudo iotedge system logs -- -f -- Logs begin at Tue 2022-03-08 12:07:39 UTC. -- Mar 25 08:53:34 SEMPER-ULTRA-EFLOW aziot-keyd[1163]: 2022-03-25T08:53:34Z [INFO] - <-- GET /key/device-id?api-version=2020-09-01 {"host": "keyd.sock"} Mar 25 08:53:34 SEMPER-ULTRA-EFLOW aziot-keyd[1163]: 2022-03-25T08:53:34Z [INFO] - --> 200 {"content-type": "application/json"} Mar 25 08:53:34 SEMPER-ULTRA-EFLOW aziot-keyd[1163]: 2022-03-25T08:53:34Z [INFO] - <-- POST /sign?api-version=2020-09-01 {"content-type": "application/json", "host": "keyd.sock", "content-length": "382"} Mar 25 08:53:34 SEMPER-ULTRA-EFLOW aziot-keyd[1163]: 2022-03-25T08:53:34Z [INFO] - --> 200 {"content-type": "application/json"} Mar 25 08:53:35 SEMPER-ULTRA-EFLOW aziot-identityd[1160]: 2022-03-25T08:53:35Z [INFO] - !!! Hub client error Mar 25 08:53:35 SEMPER-ULTRA-EFLOW aziot-identityd[1160]: 2022-03-25T08:53:35Z [INFO] - !!! caused by: ErrorCode:ArgumentInvalid;Requested Host is not supported Mar 25 08:53:35 SEMPER-ULTRA-EFLOW aziot-identityd[1160]: 2022-03-25T08:53:35Z [INFO] - --> 404 {"content-type": "application/json"} Mar 25 08:53:35 SEMPER-ULTRA-EFLOW aziot-edged[1155]: 2022-03-25T08:53:35Z [WARN] - Error in watchdog when checking for edge runtime status: Mar 25 08:53:35 SEMPER-ULTRA-EFLOW aziot-edged[1155]: 2022-03-25T08:53:35Z [WARN] - A module runtime error occurred. Mar 25 08:53:35 SEMPER-ULTRA-EFLOW aziot-edged[1155]: 2022-03-25T08:53:35Z [WARN] - caused by: HTTP response error: [404 Not Found] {"message":"Hub client error\ncaused by: ErrorCode:ArgumentInvalid;Requested Host is not supported"} Mar 25 08:54:34 SEMPER-ULTRA-EFLOW aziot-edged[1155]: 2022-03-25T08:54:34Z [INFO] - Checking edge runtime status Mar 25 08:54:34 SEMPER-ULTRA-EFLOW aziot-edged[1155]: 2022-03-25T08:54:34Z [INFO] - Creating and starting edge runtime module edgeAgent Mar 25 08:54:34 SEMPER-ULTRA-EFLOW aziot-identityd[1160]: 2022-03-25T08:54:34Z [INFO] - <-- PUT /identities/modules/$edgeAgent?api-version=2020-09-01&type=aziot {"content-type": "application/json", "host": "2f72756e2f617a696f742f6964656e74697479642e736f636b:0", "content-length": "40"}

Thanks a lot. I appreciate your help!

shijiong commented 2 years ago

I met this issue today after VS Code is updated to 1.70.0. Have you solved this issue?

rido-min commented 2 years ago

Hi @shijong

Wondering if your hub name is using any special characters. Can you try to create another hub to try again? Can you list your devices from the az cli ?

I am not able to repro with latest VSCode.

BTW, the issues related to IoT Edge should be reported in the IoT Edge repo.

shijiong commented 2 years ago

Dear @rido-min

Thank you for your response.

The location of my IoTHub is East Asia.

As you suggested, I try to create another IoTHub in East US, then I can see the device from the Azure IoTHub Extension in VS code.

So, maybe there is something wrong with the IoTHub in East Asia.

Would you please check me with this?

Thank you very much!

rido-min commented 2 years ago

I just created a new hub in East Asia and everything looks good, wondering if the hub name, maybe using extended characters, might be the cause,

yahanda commented 2 years ago

+1, my customer is facing the same issue.

I can see the devices in my IoT Hub in Japan East with VSCode, but I can't see in customer's IoT Hub which is also located in Japan East region. The hub name contains only alphabets and no numbers or other special characters. It seems that the behavior is different depending on IoT Hub. I think it's a VSCode issue since I can see the devices from Azure IoT Explorer and Azure CLI. Could you please investigate?

Thanks,

rido-min commented 2 years ago

Seems there is an issue when using uppercase letters in the hostname, can you try again using a lowercase hostname in your connection string?

yahanda commented 2 years ago

@rido-min Thank you for your advice, I tried with lowercase hostname, and it worked fine! Please let me know if there are any updates on this issue. Thanks!