Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.3k stars 429 forks source link

Error with Extension bundles: Value cannot be null. (Parameter 'provider') #2746

Open lechnerc77 opened 2 years ago

lechnerc77 commented 2 years ago

I created a sample Durable Function (TypeScript) and try to start it locally. The storage is emulated via Azurite. During start-up the error Value cannot be null. (Parameter 'provider') occurs.

The settings are:

The log output with CLI_DEBUG=1 and verbose gives the following:

Azure Functions Core Tools
Core Tools Version:       3.0.3734 Commit hash: 61192bb28820be76916f85209916152801483456  (64-bit)
Function Runtime Version: 3.1.4.0

[2021-10-04T07:22:22.932Z] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '093ed751-f1e8-44e7-b1fa-19029a12a7bd'
[2021-10-04T07:22:22.999Z] Reading host configuration file 'C:\Users\Christian\Projects\Netherite-Migration\host.json'
[2021-10-04T07:22:23.003Z] Host configuration file read:
[2021-10-04T07:22:23.005Z] {
[2021-10-04T07:22:23.007Z]   "version": "2.0",
[2021-10-04T07:22:23.008Z]   "logging": {
[2021-10-04T07:22:23.010Z]     "applicationInsights": {
[2021-10-04T07:22:23.012Z]       "samplingSettings": {
[2021-10-04T07:22:23.013Z]         "isEnabled": true,
[2021-10-04T07:22:23.015Z]         "excludedTypes": "Request"
[2021-10-04T07:22:23.016Z]       }
[2021-10-04T07:22:23.018Z]     }
[2021-10-04T07:22:23.020Z]   },
[2021-10-04T07:22:23.021Z]   "extensionBundle": {
[2021-10-04T07:22:23.023Z]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[2021-10-04T07:22:23.024Z]     "version": "[2.*, 3.0.0)"
[2021-10-04T07:22:23.026Z]   }
[2021-10-04T07:22:23.027Z] }
[2021-10-04T07:22:23.044Z] Loading functions metadata
[2021-10-04T07:22:23.075Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:java
[2021-10-04T07:22:23.099Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:powershell
[2021-10-04T07:22:23.111Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:python
[2021-10-04T07:22:23.115Z] Reading functions metadata
[2021-10-04T07:22:23.131Z] 3 functions found
[2021-10-04T07:22:23.148Z] 3 functions loaded
[2021-10-04T07:22:23.152Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at C:\Users\Christian\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle
[2021-10-04T07:22:23.155Z] Fetching information on versions of extension bundle Microsoft.Azure.Functions.ExtensionBundle available on https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/index.json
[2021-10-04T07:22:24.043Z] Downloading extension bundle from https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/2.6.1/Microsoft.Azure.Functions.ExtensionBundle.2.6.1_any-any.zip to C:\Users\Christian\AppData\Local\Temp\a72387c5-f4d3-42ac-b050-ed6b567fd932\Microsoft.Azure.Functions.ExtensionBundle.2.6.1.zip
System.ArgumentNullException: Value cannot be null. (Parameter 'provider')
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Azure.Functions.Cli.Actions.HostActions.StartHostAction.RunAsync() in D:\a\1\s\src\Azure.Functions.Cli\Actions\HostActions\StartHostAction.cs:line 343
   at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 66
[2021-10-04T07:24:41.799Z] Stopping host...
[2021-10-04T07:24:41.803Z] Host shutdown completed

The host.json is:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  }
}

The local.settings.json is:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "node"
  }
}

I found several other issues (like https://github.com/Azure/azure-functions-core-tools/issues/2364 and https://github.com/Azure/azure-functions-core-tools/issues/2232) on that, but no consistent fix as func extensions install is a workaround.

I cross-checked via a simple HTTP triggered Function and removed the extension bundle there. Everything worked as expected there so probably an issue in the context of the extension bundle.

apawast commented 2 years ago

@soninaren can you please help take a look at this?