简体   繁体   中英

Azure Functions, "System.Private.CoreLib: Value cannot be null. (Parameter 'path1'). Value cannot be null. (Parameter 'provider')"

I'm running Azure functions/core tools 3.x, in my Gradle (version 4.6) Java (JDK 1.8) project with azure functions apps. I have a GET endpoint at localhost:7071 at api/devices I am trying to hit, but I keep getting errors running azureFunctionsRun.

When I run azureFunctionsPackage, it seems to work fine. When I run azureFunctionsRun, I get the error posted below. When I used to be on azure core tools 2.x, I was apple to use the command "func start", and everything worked flawlessly. I have the host.json file with the boilerplate version and ExtensionBundles script and local.settings.json with a connection string for my Azure Web Jobs Storage:

Azure Functions Core Tools found.
Starting running Azure Functions...
Executing command: cmd.exe /c cd /D C:\git\edge_bootstrap_ms\build\azurefunctions\edge-bootstrap-ms && func host start

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

Azure Functions Core Tools (3.0.2106 Commit hash: 5431fca4f603bf9446d7dd2d5f96a43b5f69b5cb)
Function Runtime Version: 3.0.13107
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:node
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:powershell
[3/18/2020 8:56:57 PM] FUNCTIONS_WORKER_RUNTIME set to java. Skipping WorkerConfig for language:python
[3/18/2020 8:56:57 PM] Starting worker process:C:\Program Files\Java\jdk1.8.0_241\bin\java  -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -noverify -Djava.net.preferIPv4Stack=true -jar "C:\Users\KBRV37\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\java\azure-functions-java-worker.jar" --host 127.0.0.1 --port 61509 --workerId 9ff09cf4-42d8-4e1a-b66e-8058754fe61a --requestId 123c617a-61e1-4b3a-98d8-13b6a5eff6c1 --grpcMaxMessageLength 134217728
[3/18/2020 8:56:57 PM] C:\Program Files\Java\jdk1.8.0_241\bin\java process with Id=10984 started
[3/18/2020 8:56:57 PM] [INFO] {Application.main}: Azure Functions Java Worker  version [ 1.5.2-SNAPSHOT]
[3/18/2020 8:56:58 PM] [INFO] {MessageHandler.handle}: Message generated by "StartStream.Builder"
[3/18/2020 8:56:59 PM] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '078289ce-7cd5-4f2f-924b-40696702867a'
[3/18/2020 8:56:59 PM] Reading host configuration file 'C:\git\edge_bootstrap_ms\build\azurefunctions\edge-bootstrap-ms\host.json'
[3/18/2020 8:56:59 PM] Host configuration file read:
[3/18/2020 8:56:59 PM] {
[3/18/2020 8:56:59 PM]   "version": "2.0",
[3/18/2020 8:56:59 PM]   "extensionBundle": {
[3/18/2020 8:56:59 PM]     "id": "Microsoft.Azure.Functions.ExtensionBundle",
[3/18/2020 8:56:59 PM]     "version": "[1.*, 2.0.0)"
[3/18/2020 8:56:59 PM]   }
[3/18/2020 8:56:59 PM] }
[3/18/2020 8:56:59 PM] Reading functions metadata
[3/18/2020 8:56:59 PM] 3 functions found
[3/18/2020 8:56:59 PM] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at (null)
[3/18/2020 8:56:59 PM] 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
[3/18/2020 8:56:59 PM] A host error has occurred during startup operation '078289ce-7cd5-4f2f-924b-40696702867a'.
[3/18/2020 8:56:59 PM] System.Private.CoreLib: Value cannot be null. (Parameter 'path1').
Value cannot be null. (Parameter 'provider')
Application is shutting down...
[3/18/2020 8:56:59 PM] Initialization cancellation requested by runtime.
[3/18/2020 8:56:59 PM] Shutting down language worker channels for runtime:java
[3/18/2020 8:56:59 PM] Stopping host...
[3/18/2020 8:56:59 PM] Host shutdown completed.
:azureFunctionsRun FAILED
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

Host.json:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 3.0.0)"
  }
}

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=myAzureAccountName;AccountKey=myAzureAccountKeyString==",
    "FUNCTIONS_WORKER_RUNTIME": "java"
  }
}

I was missing the configurations values in 'local.setting.json' which i was using in the constructor of my DI services. By adding those values fixed my problem. hope your would be too.

I was able to fix this by uninstalling the coretools 3.x and reinstalling. Or like I said in this post, if you are lazy, you can click that extensionsbundle link that shows up in the console when the azurefunctinosrun fails, and it will work right after your run azurefunctions again.

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