'BlobTrigger not working for any new directory I am adding to a blob
I am creating a blobTrigger on an existing Function App for a new folder (status/inbound/Received) on an existing blob as follows:
public static class MyTrigger
{
[FunctionName("MyTrigger")]
public static async Task Run([BlobTrigger("status" + "/" + "inbound" + "/" + "Received" + "/{name}", Connection = "AzureWebJobsStorage")] Stream myBlob, string name, ILogger log)
{
log.LogInformation($"Blob trigger MyTriggerfunction Name:{name} Size: {myBlob.Length} Bytes");
try
{
log.LogInformation($"MyTrigger processing a request for blob name: {name}");
}
catch (Exception ex)
{
log.LogError("MyTrigger" + ex.ToString());
}
}
}
When I drop a file into the folder Received nothing happens. When I look at the live logs nothing happens.
When I change the path to a folder that has been created already it works. It does not work whenever I add a new directory
Solution 1:[1]
After reproducing from our end here is how it worked, You can directly give the path "status/inbound/Received/{name}".
Here is the code that worked for us
public static void Run([BlobTrigger("status/inbound/Received/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, ILogger log)
{
log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
try
{
log.LogInformation($"MyTrigger processing a request for blob name: {name}");
}
catch (Exception ex)
{
log.LogError("MyTrigger" + ex.ToString());
}
}
In logs
Solution 2:[2]
I resolved this issue myself. I figured out there is was a bug in the earlier version of Nuget package Microsoft.Azure.Webjobs.Extensions.Storage. I upgraded the version and it solved my issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SwethaKandikonda-MT |
| Solution 2 | Jeremy Caney |

