When I was working on the Azure Function's
Module name: Chain Azure Functions together using input and output bindings
I got an error only after adding the output bindings.
Error message:
2024-05-02T16:44:00.267 [Error] Executed 'Functions.HttpTrigger3' (Failed, Id=3adfe2ef-2c11-411c-ab66-46371138cc42, Duration=10ms)Cosmos DB connection configuration 'CosmosDB' does not exist. Make sure that it is a defined App Setting.
To resolve it, In Function's environment variable, had only two values namely AccountEndpoint and AccountKey. But later I added 2 more values as well namely, Database value and containerId.
AccountEndpoint=https://<accountname>.documents.azure.com:443/;AccountKey=<key>;
Database=func-io-learn-db;containerId=Bookmarks;
After restarting the function, following was the error message,
New Error Message: 2024-05-02T17:37:01.582 [Error] Executed 'Functions.HttpTrigger3' (Failed, Id=6241cece-4917-4180-aa78-257c4427133b, Duration=10ms)Value cannot be null. (Parameter 'containerId')
Furthermore, following was function.json file:
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"name": "bookmark",
"direction": "in",
"type": "cosmosDB",
"partitionKey": "{id}",
"methods": [],
"databaseName": "func-io-learn-db",
"collectionName": "Bookmarks",
"connectionStringSetting": "azcosmosdbaccount1_DOCUMENTDB",
"id": "{id}"
},
{
"name": "newbookmark",
"direction": "out",
"type": "cosmosDB",
"partitionKey": "/id",
"methods": [],
"databaseName": "func-io-learn-db",
"collectionName": "Bookmarks",
"connectionStringSetting": "azcosmosdbaccount1_DOCUMENTDB"
},
{
"name": "newmessage",
"direction": "out",
"type": "queue",
"queueName": "bookmarks-post-process",
"methods": [],
"connection": "learn72620e65a50a4980b5_STORAGE"
}
``` ]
}
I went through the post and made the necessary changes. But the error message did not change. Any help would be greatly appreciated.