简体   繁体   中英

IoT Edge module fails to send a message to edgeHub with 400 error after updating IoT Edge runtime to version 1.3.0

Observed Behaviour:

Custom IoT Edge module failed to send message to the edge hub with a 400 "missing request body" error. The IoT Edge daemon prints the following message to the logs:

Jul 13 16:43:34 kalki-VirtualBox aziot-edged[8415]: 2022-07-13T11:13:34Z [INFO] -
 <-- POST /modules/KalkiioEdgeIoTModule/genid/637922543947991885/sign?api-version=2018-06-28 {"content-type": "application/json; charset=utf-8", "host": "/var/run/iotedge/workload.sock:0", "content-length": "189"}
Jul 13 16:43:34 kalki-VirtualBox aziot-edged[8415]: 2022-07-13T11:13:34Z [INFO] - --> 400 {"content-type": "application/json"}

The custom module prints the following log:

executing HTTP request fails, status=400, response_buffer={"message":"missing request body"}

The custom module was successfully sending messages to the edge hub till IoT Edge runtime version 1.2.10. This issue was noticed in a new device with the latest IoT Edge runtime version 1.3.0. No other changes in deployment or otherwise were done to the setup.

Tried adding an environment variable SslProtocols with text value as tls1.0, tls1.1, tls1.2 for edgehub module, after going through the points to be aware section in this article published by Microsoft. But the issue remains the same.

The module is using Azure IoT Device SDK (C). Does anyone know if any change is expected in the Custom module to make it compatible with the latest release of IoT Edge runtime?

Unfortunately, the error is because of the type of procedure connecting to the edge module. IoT edge module Version 1.3 cannot connect to Azure-iot-sdk. So, this is the error caused due to the implementation procedure mismatch.

Similar issue recorded

It seems this is a bug in the new version of the runtime. The version 1.3.0 is expecting the value of "content-type" in the HTTP header to be exactly "application/json" .

The Azure IoT Device SDK for C is by default setting the content-type as "application/json; charset=utf-8" . For now, anybody who needs to get their modules working with Azure IoT device SDK in C with runtime version 1.3.0 should try changing the headers.

I got it working after the change.

Best idea would be to go back to 1.2 version and wait for a fix.

Github issue: https://github.com/Azure/iotedge/issues/6505

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM