it worked for me:
https://stackoverflow.com/questions/61988060/azure-cosmos-db-input-binding-for-an-azure-function-doesnt-work
Azure learning error: Can't bind CosmosDB to type 'System.String'

While doing the https://learn.microsoft.com/en-gb/learn/modules/chain-azure-functions-data-using-bindings/, "Exercise - Read data with input bindings", I'm getting error
> 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.
Everything is set correctly, exactly the same as specified in the tutorial (I've done it x3 to be sure).
Seems like a bug to me.
5 additional answers
Sort by: Most helpful
-
Barcellos Ryff, João Alberto 26 Reputation points
2020-06-09T21:46:45.977+00:00 Removes the "sqlQuery": "" from your function.json file
-
Stefan Walter 16 Reputation points
2020-06-29T19:15:30.023+00:00 You have to remove manually the "sqlQuery": "" line from your binding in your file function.json. Afterward, your HTTP result code of 500 should change to 200.
Working Sample:
{ "name": "bookmark", "direction": "in", "type": "cosmosDB", "databaseName": "func-io-learn-db", "collectionName": "Bookmarks", "connectionStringSetting": "exercise-app-sw1980_DOCUMENTDB", "id": "id", "partitionKey": "id" }
-
Lein Ton 11 Reputation points
2020-06-03T09:17:04.943+00:00 Looks like the CosmosDB input binding doesn't keep its configuration.
I had the same issue, edited the binding's config in function.json (removed the empty sqlquery and updated "id" to "Id".)
Then checked the CosmosDB input connection on the integration screen and found it empty.
After filling in the details again, the function started working. -
Leon Laude 85,226 Reputation points
2020-06-02T14:42:41.447+00:00 Hi,
Q&A currently supports the products listed over here https://learn.microsoft.com/en-us/answers/products (more to be added later on).
You can reach the experts in the dedicated "Microsoft Learning - Microsoft Azure Training" forum over here:
https://trainingsupport.microsoft.com/en-us/tcml/forum/tcml_mat(Please don't forget to accept helpful replies as answer)
Best regards,
Leon