azure-functionsazure-blob-storageazure-blob-trigger

Blob-triggered function works locally but not deployed (not invoked)


Got a function working locally, triggered when a file is dropped and now deploying to azure.

Function signature looks like this. Notice the binding expression.
This expression is attempting to pull a value from appsettings called "MyFolderPath"
Locally this works as expected. The path is container/folder_name
The setting is available in azure under Environment variables.
However, when I drop a new file in that path, the function is not triggered or invoked.
What can I check?

public async Task Run([BlobTrigger("%MyFolderPath%/{name}",Connection = "FuncStorage", Stream stream, string name)

Solution

  • Initially I was getting same issue. but, after adding the storage connection string in function app environment variables working as expected.

    enter image description here

    I have created blob trigger function with run time stack .NET 8.0. The function got triggered when i uploaded blobs in container.

    Function code:

    public class Function1
    {
        private readonly ILogger<Function1> _logger;
    
        public Function1(ILogger<Function1> logger)
        {
            _logger = logger;
        }
    
        [Function(nameof(Function1))]
        public async Task Run([BlobTrigger("hello32/{name}", Connection = "Connection23")] Stream stream, string name)
        {
            using var blobStreamReader = new StreamReader(stream);
            var content = await blobStreamReader.ReadToEndAsync();
            _logger.LogInformation($"C# Blob trigger function Processed blob\n Name: {name} \n Data: {content}");
        }
    }
    

    local.settings.json:

    {
        "IsEncrypted": false,
      "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
        "Connection23": "your-storage conn-string"
      }
    }
    

    enter image description here

    I have published the function into azure portal successfully. check below:

    enter image description here

    When I uploaded the blobs in container the function got triggered in portal as well. check the below traces:

    enter image description here

    Below are uploaded blobs in storage container.

    enter image description here