Blob Trigger function does not fire unless you visit the portal

I have seen many cases where the blob trigger functions do not fire unless you explicitly visit the portal (function app blade). There might be several reasons for this issue, but I am going to mention the most common one.


 


When a Function App is running the host takes care of automatically receiving/polling for new events across all of our various trigger types (queues, event hubs, blobs, etc.). However, some differences arise based on the tier you’re running in.


 


In our Dynamic SKUs, we have a service external to the Function App that is responsible for monitoring work and ensuring the Function App is running when it needs to be. When there is no work to perform (e.g., no queue messages, no new blobs, etc.), the Function App goes to sleep. It is the responsibility of the external service to ensure that it is woken up when work arrives.


 


In our Classic SKUs (Basic/Standard) this external monitor is not in the picture. The Function App must be run in Always On mode to keep it alive. This setting should be automatically configured to On for you when you create a Function App in a classic tier.


 


With all that background explained, if you’re running in Dynamic SKU, things should “just work.” If you’re running in a Classic SKU, make sure you have Always On enabled. That’s a common issue people run into.


 



  • The function app is running on a runtime version V1 : There is a known issue where blob polling does not work as expected in the function runtime V1. This issue has been fixed in runtime version V2; however, it is not backported to the V1.



 



  • The storage version is V2: Sometimes, this issue happens when the Storage which the function app is configured to work with is of type V2.


    • The workaround to mitigate this issue to change the storage version from V2 to V1.



 


Recommendation: Though there is an inbuilt blob trigger function, it is best to set up an Event Grid subscription and trigger with Azure Functions when it comes to processing the blobs. The notifications are sent when blob operations take place. This also enables an improved experience when it comes to the speed Azure Functions will be able to react to those events. You need to create an Event Grid Trigger function and configure the “Event Grid Subscription URL” from Integrate tab of the function.


 


For information on the Event Grid trigger with Azure Functions:



  1. https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-grid


Reacting to blob events using Event Grid:



  1. https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-event-overview


 


Note: Event Grid subscription is only available in Storage V2.


 


Authored By – Sunny Dewangan

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.