.netazureazure-functionsazure-blob-trigger

Function App with binding expression not triggering


I am using Binding Expression and Complex Object settings like so in my blobtrigger function app. I have included "local.settings.json" file using DI by overriding ConfigureAppConfiguration() as explained in the link.

[FunctionName(nameof(UnzipFunction))]
[StorageAccount("InternalStorage:ConnectionString")]
public async Task RunAsync([BlobTrigger("%InternalStorage:Container%/{fileNameWithoutExt}.zip")] BlobClient blobClient,
                           string fileNameWithoutExt,
                           IDictionary<string, string> metadata)

Edit: Code to include json file:

public override void ConfigureAppConfiguration(IFunctionsConfigurationBuilder builder)
    {
        FunctionsHostBuilderContext context = builder.GetContext();

        builder.ConfigurationBuilder
                .AddJsonFile(Path.Combine(context.ApplicationRootPath, "local.settings.json"), optional: false, reloadOnChange: true)
                .AddEnvironmentVariables();
    }

Here's my local.settings.json. I have set CopyToPublishDirectory for this file to Always and I can see the file when App is published.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "InternalStorage:ConnectionString": "{connection-string}",
    "InternalStorage:Container": "{container-name}"
  }
}

When I run the code locally the FunctionApp is triggered on the file upload but when I publish the app the FunctionApp is not getting triggered. I've also tried setting the variables manually on the published app, still the App isn't being triggered.

Could someone guide me if I'm doing it correctly? Is there a way debug this? My function.json looks like this: enter image description here


Solution

  • Just noticed that under Diagnose and solve problems I am getting below error. Missing Application Settings detected The following Application Settings are referenced in Function bindings but not configured in the Function App. This can cause execution errors Function: unzipfunctionapp/UnzipFunction, Binding parameter: blobClient, Application setting: InternalStorage:ConnectionString

    enter image description here