0

I am developping an Azure Function with the following structure: Trigger: IoT Hub event. Function: Gets the body of the telemetry message and applies some decoding to the data. Output: Sends the processed data as json to en Event Hub.

IoT Hub ---> Az Function ---> Event Hub

When deployed to Azure, the function gets triggered correctly every time there is a telemetry message in the IoT Hub, but it does not execute correctly.

When triggered, the function executes with "success"=False.

enter image description here

On the other hand, when testing/debugging in the Azure portal, I proceed as specified in the answer of this question, entering as message body

{
    "input": "{\"SystemProperties\":{},\"SomeId\":\"123\",\"Status\":\"Available\"}"
}

and I always get this error message when the function is finished executing:

Result: Failure Exception: NotImplementedError: unexpected Datum type: None Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 485, in _handle__invocation_request return_value = bindings.to_outgoing_proto( File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/bindings/meta.py", line 151, in to_outgoing_proto return datumdef.datum_as_proto(datum) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/bindings/datumdef.py", line 200, in datum_as_proto raise NotImplementedError(

Initially, I have tried to run the code that Microsoft provides as template for EventHub triggered functions:

def main(event: func.EventHubEvent):
    logging.info(f'Function triggered to process a message: {event.get_body().decode()}')
    logging.info(f'  EnqueuedTimeUtc = {event.enqueued_time}')
    logging.info(f'  SequenceNumber = {event.sequence_number}')
    logging.info(f'  Offset = {event.offset}')

    # Metadata
    for key in event.metadata:
        logging.info(f'Metadata: {key} = {event.metadata[key]}')

The logging works propperly, and the info is displayed on the debugging monitor tab, but when it finishes logging the info it throws error mentioned above.

NoelGK
  • 1

0 Answers0