Azure Event Hubs with Azure Function - Serialization failed due to an unsupported type, System.Byte[]

Eric H 5 Reputation points
2024-07-15T21:45:42.5766667+00:00

I am getting this error sometimes my function gets an event from azure event hubs:
Azure.Core.Amqp: Serialization failed due to an unsupported type, System.Byte[]

I can go to azure and generate an event, and it works fine, the EventData[] gets bound properly, and I can step through my function.

But any events created by our Kafka Change Data Capture end up triggering this exception (on this single consumer).

In the erroring consumer, I can change the "EventData[]" to "string[]" and the function runs, but then I lose the "partitionkey" information that I want.

We have other azure function consumers consuming the same event, with what appears to be the same basic code, and the bindings all work fine using EventData[].

Function signature (this one works):
public static async Task RunMaster([EventHubTrigger("%MasterEventHubName%", Connection = "EventHubConnectionMaster")] EventData[] eventsNames, ILogger log)

Here is the function signature that doesn't work:

public async Task Run([EventHubTrigger("%EventHub:Subscribe:Name%", Connection = "EventHub:Subscribe:SecretAuth:ConnectionString")] EventData[] events, ILogger log)

Both projects are using Azure.Messaging.EventHubs >6.0

The payload of the event only has simple properties (int and string).

What could be causing that serialization error?

Thank you,

Eric

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
644 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.