Hi @RangerSayip Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.
I did try out the steps provided in the article and could modify the function.json
file multiple times without any issues. You could be facing a browser cache issue or an intermittent platform error which might be preventing from making changes to the file. If you continue to face this error, please create a new function within the Function app and see if it works as expected.
"Value cannot be null. (Parameter 'containerId')"
As you identified in your research, referencing the CosmosDB with CollectionName
in the bindings would result in this error. Instead, use ContainerName
I have further noticed that you are setting the partitionKey
property as /id
According to the documentation, this has to be set as {id}
. With the current configuration you have, even though you modify the containerName
in the bindings, you would still see No bookmarks found
error when you try to access the CosmosDB data. Please refer the following set of binding that I have tested and could confirm the working behavior
{
"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}",
"databaseName": "func-io-learn-db",
"containerName": "Bookmarks",
"connection": "funcappcosmos_DOCUMENTDB",
"id": "{id}"
}
]
}
Hope this helps! If you keep encountering the same error even with the newly created function, please let us know and we would be able to help you further.
Update
Issue resolved by creating the Azure function through Azure CLI.
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.