I was following a walkthrough from microsoft learning on how to add an input binding with CosmosDb for an azure function, however when calling the function it keeps returning internal server error (500 http code).
The configuration of the azure function from function.json is:
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "Request",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "Response"
},
{
"name": "bookmark",
"direction": "in",
"type": "cosmosDB",
"databaseName": "func-io-learn-db",
"collectionName": "Bookmarks",
"connectionStringSetting": "learn_DOCUMENTDB",
"id": "{id}",
"partitionKey": "{id}",
"sqlQuery": ""
}
]
}
There is a learn_DOCUMENTDB configuration settings in the app service which has a valid connection string to cosmos db instance (was automatically created).
The error log entry says that:
Can't bind CosmosDB to type 'System.String'. Possible causes: 1) Tried binding to 'Microsoft.Azure.Documents.Client.DocumentClient, Microsoft.Azure.DocumentDB.Core, Version=2.9.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' but user type assembly was 'System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e.
Is there something I do wrong?