3
votes

I am using App service plan for azure function, and have added blob triggers but when any file is uploaded to blob container,Functions are not triggering .or sometime its taking too much time , then after it start triggering. Any suggestion will be appreciated

It should trigger the function as and when new files is uploaded to blob container.

2
Could you specify what delay you are getting and what you expect? - Christoph

2 Answers

2
votes

This should be the case of cold-start

As per the note here

When you're using a blob trigger on a Consumption plan, there can be up to a 10-minute delay in processing new blobs. This delay occurs when a function app has gone idle. After the function app is running, blobs are processed immediately. To avoid this cold-start delay, use an App Service plan with Always On enabled, or use the Event Grid trigger.

For your case, you need to consider Event-Grid trigger instead of a blob trigger, Event trigger has the built-in support for blob-events as well.

1
votes

Since you say that you are already running the functions on an App Service plan, it's likely that you don't have the Always On setting enabled. You can do this from the Application Settings -> General Settings tab on the portal:

Enable Always On

Another possible cause is if you don't clear the blobs out of the container after you process it.

From here:

If the blob container being monitored contains more than 10,000 blobs (across all containers), the Functions runtime scans log files to watch for new or changed blobs. This process can result in delays. A function might not get triggered until several minutes or longer after the blob is created.

And when using the Consumption Plan, here's another link warning about the potential of delays.