I have an Azure Function triggered by EventGridEvents.
function.json set accordingly:{
"scriptFile": "__init__.py",
"bindings": [{
"name": "event",
"type": "eventGridTrigger",
"direction": "in"
}]
}
__init__.py dialed in (only snippet shown here):def main(event: func.EventGridEvent):
result = json.dumps({
'id' : event.id,
'data' : event.get_json(),
'topic' : event.topic,
'subject' : event.subject,
'event_type' : event.event_type
})
EventGrid message here:
I'd like to now see the actual EventGrid message and debug why the Function didn't trigger, but I can't find a place to view the message!
I waited ~30mins, refeshed multiple times and was even watching the AppInsights live logs, no trigger.

EventGrid message after its successfully publishedEDIT 1:
Digging around for a while I found this other "metric" that shows 0 Delivered Events
How is an event "Published" but not "Delivered"?

I have done a test. On my side it seems no problem.
Maybe something different between yours and mine.
Please check:
_init_.py
import json
import logging
import azure.functions as func
def main(event: func.EventGridEvent):
result = json.dumps({
'id': event.id,
'data': event.get_json(),
'topic': event.topic,
'subject': event.subject,
'event_type': event.event_type,
})
logging.info('Python EventGrid trigger processed an event: %s', result)
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"type": "eventGridTrigger",
"name": "event",
"direction": "in"
}
]
}
And this is my eventgrid subscription:(I add a blob to the specific container and delete it. Please notice that the metric of the eventgrid subscription may take about 5 minutes to show. But it will trigger your endpoint function immediately.)

This is the filter of my eventgrid subscription:

I want the blob created and deleted in the test container to trigger the endpoint azure function, so I add /blobServices/default/containers/test to the 'Subject Begins With' section.
Then my function works fine:

The easiest option will be to create an Azure subscription to the event grid topic and write the message to an ALDS storage account storage queue. You can set the settings on the storage queue on how long you want a message persisted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With