Azure / azure-functions-core-tools

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

Cannot start local function, Error "System.ArgumentNullException: Value cannot be null. (Parameter 'provider')" #3238

Open dev-jan opened 1 year ago

dev-jan commented 1 year ago

Hi, I notice that the latest version of the Azure Functions Core Tools via npm causes an "Value cannot be null" error every time. I also try to install in on a new Computer, but still the same issue. I tried some workarounds from other Issues like deleting the "~/.azure-functions-core-tools/", but nothing works... Is there maybe an Issue with this version? Or is there any way to get past this error and be able to start Azure Functions again locally (it works before updating to the newest version - sadly, a downgrade does not make it work again).

Steps to reproduce:

  1. Install the Azure Function Core Tools via Ubuntu APT Repo
  2. Create a new example function using "javascript" as language
  3. Try to run the function locally, no luck. Using various debug params this is the output:
$ CLI_DEBUG=1 func host start --verbose

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

Azure Functions Core Tools
Core Tools Version:       4.0.4895 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.13.0.19486

Setting unsupported .NET environment variables (empty string) is not implemented for this platform.
[2023-01-05T20:44:22.627Z] Building host: version spec: , startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '8f847547-293a-48b7-9d7a-0f11d26acf93'
[2023-01-05T20:44:22.635Z] Reading host configuration file '/home/jan/azure-test-function/host.json'
[2023-01-05T20:44:22.636Z] Host configuration file read:
[2023-01-05T20:44:22.636Z] {
[2023-01-05T20:44:22.636Z]   "version": "2.0",
[2023-01-05T20:44:22.636Z]   "logging": {
[2023-01-05T20:44:22.636Z]     "applicationInsights": {
[2023-01-05T20:44:22.636Z]       "samplingSettings": {
[2023-01-05T20:44:22.637Z]         "isEnabled": true,
[2023-01-05T20:44:22.637Z]         "excludedTypes": "Request"
[2023-01-05T20:44:22.637Z]       }
[2023-01-05T20:44:22.637Z]     }
[2023-01-05T20:44:22.637Z]   },
[2023-01-05T20:44:22.637Z]   "extensionBundle": {
[2023-01-05T20:44:22.637Z]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[2023-01-05T20:44:22.637Z]     "version": "[3.*, 4.0.0)"
[2023-01-05T20:44:22.637Z]   },
[2023-01-05T20:44:22.637Z]   "extensions": {
[2023-01-05T20:44:22.637Z]     "http": {
[2023-01-05T20:44:22.637Z]       "routePrefix": ""
[2023-01-05T20:44:22.637Z]     }
[2023-01-05T20:44:22.637Z]   }
[2023-01-05T20:44:22.637Z] }
[2023-01-05T20:44:22.664Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: python
[2023-01-05T20:44:22.665Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: powershell
[2023-01-05T20:44:22.693Z] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language: java
[2023-01-05T20:44:22.695Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /home/jan/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[2023-01-05T20:44:22.695Z] Found a matching extension bundle at /home/jan/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/3.17.0
[2023-01-05T20:44:22.715Z] Loading functions metadata
[2023-01-05T20:44:22.717Z] Reading functions metadata
[2023-01-05T20:44:22.718Z] Reading functions metadata
[2023-01-05T20:44:22.730Z] 1 functions found
[2023-01-05T20:44:22.732Z] 1 functions found
[2023-01-05T20:44:22.742Z] 1 functions loaded
[2023-01-05T20:44:22.744Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /home/jan/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle
[2023-01-05T20:44:22.744Z] Found a matching extension bundle at /home/jan/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/3.17.0
[2023-01-05T20:44:22.745Z] 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
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\_work\1\s\src\Azure.Functions.Cli\Actions\HostActions\StartHostAction.cs:line 380
   at Azure.Functions.Cli.ConsoleApp.RunAsync[T](String[] args, IContainer container) in D:\a\_work\1\s\src\Azure.Functions.Cli\ConsoleApp.cs:line 64
[2023-01-05T20:46:36.492Z] Stopping host...
[2023-01-05T20:46:36.495Z] Host shutdown completed.

I am using Ubuntu 22.04.1 LTS.

puthurr commented 1 year ago

Facing the same issue with

Core Tools Version: 4.0.4915 Commit hash: N/A (64-bit) Function Runtime Version: 4.14.0.19631