Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using EventHubOutput with EventData any Properties added to the EventData are NOT propagated to the Message on EventHub #2932

Open
cicorias opened this issue Jan 23, 2025 · 0 comments
Labels
Needs: Triage (Functions) potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug

Comments

@cicorias
Copy link
Member

Description

Using EventHubOutput on a function that returns a type of EventData results in loss of the Properties that should be propagated to the EventHub message.

Using EventHubOutput
Image

Using non Azure Functions via console app as follows:

           var eventData = new EventData(Encoding.UTF8.GetBytes($"Event {i}"));
            eventData.Properties.Add("EventId", i);
            eventData.Properties.Add("EventType", "Test");
            eventData.Properties.Add("EventTime", DateTime.UtcNow);
            await producerClient.SendAsync(new [] {eventData}, sendOptions);

Image

Steps to reproduce

  1. Create an azure function of any Trigger type with EventHubOutput return type of EventData or EventData[]
[EventHubOutput("ns1", Connection = "APP_TARGET_EVENT_HUB")]
   public EventData Run(
       [EventGridTrigger] EventGridEvent resultEvent,
       FunctionContext context)
   ...
  1. In the body create an EventData instance with properties.
        var outEvent = new EventData(Encoding.UTF8.GetBytes(JsonSerializer.Serialize(defenderScanResult))){
            Properties = {
                { "source", "FOO" },
                { "thing", "iotevent" }
            }
        };

       return outEvent;
  1. Using Service bus explorer or any other method listen to the Event Hub and examine the message

NOTE: on the event received there will be no Properties propagated except for Diagnostic-Id

@cicorias cicorias added the potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage (Functions) potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant