@azuresupport #azTechHelp I have an event grid topic with an Azure Function subscriber that has a CosmosDB output binding. Here is the function
export default async (context, eventGridEvent) => {
try {
context.log(`Saving Asset`);
context.log(`subject : ${eventGridEvent.subject}`)
context.log(`eventType : ${eventGridEvent.eventType}`)
var importObject = eventGridEvent.data;
if(!importObject.asset.id)
{
throw new Error("Supplied Asset does not have an ID specified, aborting!");
}
else
{
context.log(`Successfully exported asset(${eventGridEvent.data.objectId}) to Cosmos`);
context.bindings.outputDocument = importObject.asset;
}
}
catch (err) {
context.log.error(err);
context.log.error(`Error Processing Event Grid Object : ${eventGridEvent}`);
throw(err);
}
};
The logic in this function will (generally) never fail, however the Cosmos DB binding can fail (and is failing due to a throughput limit). So the function fails, but thats ok our Event Grid will retry, right? Wrong!
Image : Azure Function Failures
The problem is that the Event Grid doesn't register the failure and in turn never retries the event.
Now we can code the function to do the Cosmos CRUD inside the function and force the error, or maybe create our own binding but we would like to stick with the built in Cosmos binding.
Can someone in Azure take a look pls?