I'm trying to run an Azure function as a docker image but I'm getting this strange log:
Azure.Storage.Queues: Value cannot be null. (Parameter 'value').
An unhandled exception has occurred. Host is shutting down.
I'm not understanding what this "value" means. I'm sure to have configured correctly all the configuration values. Here's the local.settings.json :
{"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"WEBSITE_NODE_DEFAULT_VERSION": "14.16.0",
"AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1;",
"AzureWebJobsSecretStorageType": "files",
"MY_CONNECTION_STRING": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;TableEndpoint=http://azurite:10002/devstoreaccount1;"
},
"ConnectionStrings": {}
}
And this is the host.json file :
{
"version": "2.0",
"logging": {
"logLevel": {
"default": "Information",
"DurableTask.AzureStorage": "Warning",
"DurableTask.Core": "Warning",
},
"extensions": {
"durableTask": {
"hubName": "HubName",
"localRpcEndpointEnabled": false,
"storageProvider": {
"connectionStringName": "MY_CONNECTION_STRING"
},
"tracing": {
"traceInputsAndOutputs": false,
"traceReplayEvents": false
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
}
}
Could you help me please ?
Azure.Storage.Queues: Value cannot be null. (Parameter 'value'). An unhandled exception has occurred. Host is shutting down.
As per your configuration, the issue seems to be related to the connection string for the storage account.
To resolve this:
local.settings.json
is correct and be sure that the storage account you are pointing to, is not deleted.you can follow two workarounds:
Workaround 1: Change local.setting.json as below:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"WEBSITE_NODE_DEFAULT_VERSION": "14.16.0",
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsSecretStorageType": "files",
"MY_CONNECTION_STRING": "your_storageaccount-Connectionstring
},
"ConnectionStrings": {}
}
Try changing the connection string format:
"MyconnectionString":"DefaultEndpointsProtocol=https;AccountName=kvpstorageaccount;AccountKey=1Lj/Uq5cMD7eNMIh9R0bReXXXXXXXXXXXXXX;EndpointSuffix=core.windows.net
you can copy it from your storage Account=>Access keys:
- you can use same host.json
configuration.
Workaround 2:
local.settings.json:
{"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"WEBSITE_NODE_DEFAULT_VERSION": "14.16.0",
"AzureWebJobsStorage":"your_connection_string",
"AzureWebJobsSecretStorageType": "files",
"ConnectionStrings": {}
}
"connectionStringName":"MY_CONNECTION_STRING"
to "connectionStringName":"AzureWebJobsStorage"
.host.json:
{
"version": "2.0",
"logging": {
"logLevel": {
"default": "Information",
"DurableTask.AzureStorage": "Warning",
"DurableTask.Core": "Warning",
},
"extensions": {
"durableTask": {
"hubName": "HubName",
"localRpcEndpointEnabled": false,
"storageProvider": {
"connectionStringName": "AzureWebJobsStorage"
},
"tracing": {
"traceInputsAndOutputs": false,
"traceReplayEvents": false
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
}
}
This aligns properly with the connection string defined in local.settings.json.