Intro
Hi all,
After logging the same issue on the Azure API Management side, and it having been fixed by their team I've noticed that this is still also an issue on the event grid connector on logic apps. I can't speak for the .NET SDK but that's a whole different story.
Before we start I want to raise that for this bug I'm specifically pointing to the "data" part of the payload in the event grid events.
I saw multiple other issues about DateTime formatting for event times but those pointed to the envelope and not the essential data part.
What might also be important is that the publisher and subscriber logic apps are both multi-tenant LA's. (would advise to also test single tenant)
Issue
When publishing an event to the event grid that contains a DateTime in the following format {"timestamp": "2020-06-19T12:54:40.180Z"} the trailing 0 milliseconds are being truncated/trimmed unexpectedly. After looking at the @azure/eventgrid package documentation I've realized that there's probably also in the LA connector ongoing DateTime formatting (maybe the EventGridDeserializer options ?), I'm unsure whether that's happening when publishing the event or when receiving it when a resource event occurs.
Example of unexpected formatting that happens.
- 2020-06-19T12:54:40.180Z becomes 2020-06-19T12:54:40.18Z
- 2020-06-19T12:54:40.100Z becomes 2020-06-19T12:54:40.1Z
- 2020-06-19T12:54:40.000Z becomes 2020-06-19T12:54:40Z
Event grid JSON Input + Output example
{
"id": "4244060f-5d50-4ab9-8b22-e9ce5052c00a",
"eventType": "CLIENT.PROJECT.ENTITY.CHANGED",
"subject": "TEST",
"data": {
"test": "2021-09-30T09:13:56.000Z"
}
}
After receiving this event in the connector "When a resource event occurs" of the logic app we see the following.
{
"data": {
"test": "2019-03-15T09:13:56Z"
},
"eventType": "CLIENT.PROJECT.ENTITY.CHANGED",
"id": "4244060f-5d50-4ab9-8b22-e9ce5052c00a",
"subject": "TEST",
"dataVersion": "",
"metadataVersion": "1",
"eventTime": "2021-09-30T17:31:57.9825801Z",
"topic": "/subscriptions/------------/resourceGroups/rg-Sandbox-SiebeVerschaeve/providers/Microsoft.EventGrid/topics/eg-sandbox-siebe"
}
There's a clear truncation ongoing on the retrieval of the event.
Our project applies a strict format yyyy-MM-dd'T'HH:mm:ss.SSS'Z' so none of our implementations expect missing milliseconds nor do our 3rd parties when we forward events.
Can someone give me some insights either on how to resolve it or confirm this is a bug?
A special thanks to @MayankBargali-MSFT for letting me tag him in on this issue as well after the resolution of the previous post.
Thanks to all from the community for participating in this thread as well.
If additional information is required from my side, feel free to request.