Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Private.Uri: Value cannot be null error with Azure Function

Tags:

I created a C# Azure Function in Visual Studio Code. When I run the function in Visual Studio Code, I get the following error:

[8/21/2020 1:27:34 AM] A host error has occurred during startup operation '803d7235-e81a-4768-a68d-15fcd93d8518'.
[8/21/2020 1:27:34 AM] System.Private.Uri: Value cannot be null. (Parameter 'uriString').
[8/21/2020 1:27:34 AM] Stopping JobHost
Value cannot be null. (Parameter 'provider')

How can I fix it?

enter image description here

like image 904
wonderful world Avatar asked Aug 21 '20 01:08

wonderful world


2 Answers

There are couple of things you can check :

  1. If we are using any connection endpoint and reading the value from the appsettings. If yes, check the value of that settings.
  2. Please confirm whether we are using a valid service bus connection endpoint in this case. ( if there is any)

These are very generic explanation for the problem statement as that doesn't provide more details. In case of functions many a times we see this error because if the connection string value is read from Azure Key Vault and you miss out on setting this value in the app settings of Azure Function configuration. In this scenario, an Access Policy created in the Key Vault configuration so that Azure Function application can read the values from the Key Vault. So you need to reverify the access policies to make sure the app settings values of the keys have valid values.

like image 88
JayaChatterjee-MSFT Avatar answered Sep 19 '22 08:09

JayaChatterjee-MSFT


For me the problem was that I had pasted an incorrect connection string value into local.settings.json - instead of "EndPoint=... I had "\"Endpoint=...

like image 38
Peter Morris Avatar answered Sep 19 '22 08:09

Peter Morris