Search code examples
c#azure-functions

Azure function fails Value cannot be null. Parameter name: value


I've created an Azure function and tested it locally in Visual Studio without issue. I just published the function to Azure and now when I run it I get this error:

2019-11-26T20:41:11.822 [Error] Executed 'PullAffiliationsFunction' (Failed, Id=13a5b787-db22-4b04-96ba-f5718c36aa75)
Value cannot be null.
Parameter name: value

I don't have any parameters named value in my function. I see no stack trace to give me more information about what is causing this error. Did I miss a configuration setting somewhere? I published directly from Visual Studio so I would expect it would publish everything. How would you debug this?


Solution

  • If you get this exception as part of the Executed message, it's most likely thrown by your function code. Do you have the full log entry for that? It may include a stack trace as well.

    The local settings and environment variables (from local.settings.json) actually do not automatically get pushed to Azure on publish.

    I have seen this exception commonly when one may have forgotten to set an environment variable as an App Setting or a connection string. Did you set all the environment variables you used locally in your Azure function app through Application Settings or configuration in your app?