I am using Azure Queue Trigger for my Function. But the Infrastructure (e.g., Queue, Blob storage) for that Function is not in place. So, the Azure storage connection string will also be empty. But while running the Function App, it is expecting the connection string and throwing an exception at runtime. Even though I disabled the Function using the [Disable("MY_TIMER_DISABLED")]
attribute.
Exception
System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString')
The reason I found is that while running the Function App, the Startup
is invoking all the Functions, and then it is reading the properties associated with those Functions. So, at the initial invoke, it is expecting the Queue, Connection String, etc., even though the function is Disabled.
public class UserDataRetryFunction()
{
[FunctionName(UserDataRetryFunction)]
[Disable("AzureWebJobs.UserDataRetryFunction.Disabled")]
public async Task RetryData([QueueTrigger("%RetryQueueName%", Connection = "%ConnectionStrings:StorageConnectionString%")])
{
// Process the Queue Message
}
}
appsetings.json
{
"IsEncrypted": false,
"RetryQueueName" : "retry-response-queue",
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobs.UserDataRetryFunction.Disabled": "true"
},
"ConnectionStrings": {
"StorageConnectionString" : "",
}
}
I have tried many documents and sites, but could not able to find the solution.
Some of the links I’ve evaluated are stated below.