Skip to content

.Net 8 isolated function app with Eventhub trigger - Serialization issue when message is published via nodejs with extra properties. #2659

Open

Description

Description

I am upgrading .Net 6 Function in-process function app to .Net 8 Isolated function app. I am using all latest libraries which are recently upgraded.

I am using nodejs code to publish my events and below is the code.


const connectionString = "{conn_str}"
    const eventHubName = "{hubName}";
    const producer = new EventHubProducerClient(connectionString, eventHubName);
  
    let evtData = {body: {"id":"c99bc0ea-6732-46ff-b1c0-6183e788e8a9","topic":"Test","subject":"playwright-test","data":{},"eventType":"Test.Logged","eventTime":"2024-08-13T18:26:28.510Z","metadataVersion":"1","dataVersion":"1"}
    ,       properties:[{clientId:"133343fa-97ba-41c5-a9ba-228a560860a3"}]
  };
   const batch = await producer.createBatch();
    batch.tryAdd(evtData );
    await producer.sendBatch(batch);

I am getting below error on my .Net8 function app

System.Runtime.Serialization.SerializationException:
   at Azure.Core.Amqp.Shared.AmqpAnnotatedMessageConverter.TryCreateNetPropertyFromAmqpProperty (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
   at Azure.Core.Amqp.Shared.AmqpAnnotatedMessageConverter.FromAmqpMessage (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
   at Azure.Messaging.EventHubs.Amqp.AmqpMessageConverter.BuildEventFromAmqpMessage (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
   at Azure.Messaging.EventHubs.Amqp.AmqpMessageConverter.CreateEventFromMessage (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
   at Azure.Messaging.EventHubs.Amqp.AmqpConsumer+<ReceiveAsync>d__42.MoveNext (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Azure.Messaging.EventHubs.Amqp.AmqpConsumer+<ReceiveAsync>d__42.MoveNext (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Azure.Messaging.EventHubs.Primitives.EventProcessor`1+<>c__DisplayClass75_0+<<CreatePartitionProcessor>g__performProcessing|1>d.MoveNext (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Azure.Messaging.EventHubs.Primitives.EventProcessor`1+<>c__DisplayClass75_0+<<CreatePartitionProcessor>g__performProcessing|1>d.MoveNext (Azure.Messaging.EventHubs, Version=5.11.5.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)

It is not even reaching any code written inside trigger.

This is blocker to us for our .Net 8 upgrade as many of our clients are using NodeJs to publish their messages to eventhub.

Versions

Publisher NodeJs
Node Version: 20
@azure/event-hubs: "5.12.0"

Function App
.Net 8 Isolated
Microsoft.Azure.Functions.Worker.Extensions.EventHubs: 6.3.5

Steps to reproduce

publish Events(eventgrid event type) to Eventhub using nodejs with extra properties.


const connectionString = "{conn_str}"
    const eventHubName = "{hubName}";
    const producer = new EventHubProducerClient(connectionString, eventHubName);
  
    let evtData = {body: {"id":"c99bc0ea-6732-46ff-b1c0-6183e788e8a9","topic":"Test","subject":"playwright-test","data":{},"eventType":"Test.Logged","eventTime":"2024-08-13T18:26:28.510Z","metadataVersion":"1","dataVersion":"1"}
    ,       properties:[{clientId:"133343fa-97ba-41c5-a9ba-228a560860a3"}] // This property is mandatory for us in order to process message.
  };
   const batch = await producer.createBatch();
    batch.tryAdd(evtData );
    await producer.sendBatch(batch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage (Functions)potential-bugItems opened using the bug report template, not yet triaged and confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions