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?
2
Answers
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
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