[BUG] EventGridPublisherClient.SendEventsAsync fails if event handler function receives single EventGridEvent
See original GitHub issueGiven the following Azure Functions v3 precompiled function:
[FunctionName("event-handle")]
public void HandleAsync([EventGridTrigger] EventGridEvent e, ILogger logger)
{
logger.LogInformation(e.Subject);
}
And an Event Grid Domain (with no custom topic) with a Domain-Scoped Event Subscription (that basically handles every event with no filters whatesoever):
When using the code shown in PublishEventsToTopic to send all events in a batch:
await client.SendEventsAsync(eventsList);
the code fails with:
This resource is configured to receive event in 'EventGridEvent' schema.
The JSON received does not conform to the expected schema. Token Expected: StartObject, Actual Token Received: EndArray.
If the code is changed to send each event individually, delivery succeeds.
Expected behavior I would expect the batching on the client to have no impact on how the handling function is authored, and automatically invoke the function multiple times for each sent event.
Environment:
- Azure.Messaging.EventGrid 4.3.0
- Hosted Azure Functions v3 runtime
- Visual Studio 16.10
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
EventGridPublisherClient SendEventAsync doesnt throw ...
it returns 200 and I see the message in Event Grid domain, which topic it will go if the particular topic doesn't exists....
Read more >Troubleshoot Azure Event Grid issues
During event subscription creation, you may receive an error message that says the validation of the provided endpoint failed.
Read more >function app can't send message to event grid
SendEventAsync(egEvent) gives me exception error: The given key '1' was not present in the dictionary. I get the key using the azure portal...
Read more >[BUG] Data property not populated for EventGridEvent object
I want to send an event using event grid, with some data. I have the following snippet of C# code: _logger.LogInformation("Broadcasting event ......
Read more >Publishing Events to an Event Grid Topic
This sample demonstrates how to publish both Event Grid and CloudEvent 1.0 schema events to the Event Grid service. You can publish events...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hi @kzu, We are sorry that you are experiencing trouble here. The stable EventGrid functions bindings still rely on the old Microsoft.Azure.EventGrid library, which is why you are seeing this behavior. There is a beta EventGrid binding that uses the new models defined in Azure.Messaging.EventGrid - https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/3.0.0-beta.3 If you would like to try it out, things should work more smoothly. Additionally, we will have a stable release of the EventGrid binding in the coming months that you can try.