2
votes

My Azure function becomes unresponsive (new Blob trigger doesn't trigger) overnight, and starts working again when I click on that job in the Azure portal UI.

update 9th August 11:17 - it is when $logs creates a new subfolder every hour, the BlobTrigger doesn't get triggered by these new files enter image description here

when a new folder is created the BlobTrigger isn't triggered when new files are created in that folder.

end update

public static class Function2
{
    [FunctionName("Function2")]
    public static void Run([BlobTrigger("$logs/{name}", Connection = "ddavemstorage")]
    Stream blobStream, string name, TraceWriter log, ExecutionContext context)

I can verify the $logs files are being written regularly (using Azure Storage Explorer) but don't trigger the BlobTrigger overnight.

enter image description here

Screenshot taken at 1016. 30minutes ago I looked at the portal Azure Function UI. It then processed the log file from 0600UTC (actually 0700 my time). And it processed all the others which it had missed.

  • Plan: Consumption: 0 Small
  • Runtime: 1.0.11913.0 (.NET full)

It may be possible this is something to do with the $logs folder. This couldn't be monitored a few years ago. https://github.com/Azure/azure-webjobs-sdk/issues/715

enter image description here

$logs folder is being written to as expected.

2
Not really answering the question, but there are some hints out there that Blob Triggers should be treated as not 100% reliable and that the newer Events model triggering via Event Grid may give better reliability than a Blog Trigger directly on a Function: see: docs.microsoft.com/en-us/azure/azure-functions/… and: docs.microsoft.com/en-us/azure/storage/blobs/… - rohancragg
I would also suggest trying a Standard App Service Plan rather than a Consumption model might provide a better reliability (but will of course cost more). - rohancragg

2 Answers

0
votes

In storage, the subfolders are virtual, and not similar to an actual file system. A workaround and possible solution for your issue is to include the full path by providing the subfolder name such as: "path": "rootcontainer/subfolder/{name}" in function.json.

There is a similar thread posted recently talking about the same issue as well, you can see it here for more info.

0
votes

By creating a second function of type TimerTrigger every 5 minutes I found that the first BlobTrigger function now picks up the files as expected.

public static class TestTimer
{
    [FunctionName("TestTimer")]
    // runs every 5 minutes
    public static void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, TraceWriter log)
    {
        log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
    }
}