简体   繁体   中英

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: 在此处输入图像描述

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

  • Glad that you detected what is causing the error which is valid.

  • Sometimes IDEs doesn't publish the configuration of local.settings.json to Azure Function App Configuration because this file name is present in .gitignore file where this file makes cloud to ignore the files if their names mentioned in.gitignore file.

  • And the We can have nested configuration format in local.settings.json where we call them in our function code with the separator double underscore ( __) but those nested configuration format will not present in the Azure Portal App Function Configuration menu where those code of calling the configuration settings in the form of environment variable is different.

在此处输入图像描述

  • One of the similar issue 8520 registered in the Azure Functions Host Issues of GitHub Repo where you can track the status for the similar error such as Function App: Missing Application Settings detected The following Application Settings are referenced in Function bindings but not configured in the Function App and is in Open Status.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM