When I try to execute newly created azure function with CosmosDBTrigger, I get the above exception for the function with cosmosdb trigger
Investigative information
Environment: Visual Studio 2017 15.3.5
Packages referenced:
- Marvin.JsonPatch.Dynamic Version="1.1.0"
- Microsoft.Azure.DocumentDB Version="1.17.0"
- Microsoft.Azure.WebJobs Version="2.1.0-beta4"
- Microsoft.Azure.WebJobs.Extensions.DocumentDB Version="1.1.0-beta4"
- Microsoft.Azure.WebJobs.ServiceBus Version="2.0.0"
- Microsoft.NET.Sdk.Functions Version="1.0.5"
- Newtonsoft.Json Version="10.0.3"
- System.Configuration.ConfigurationManager Version="4.4.0"
Steps to reproduce the issue
Provide the steps required to reproduce the problem:
- Create a new Azure Function Project from Visual Studio
- Add a function (i didn't find any option for CosmosDB Binding so i created using HttpTrigger) once the .cs file is created, replace the file with the code that i have put below.
- Build
- Hit F5
Here is the code sample
public static class AddEventInEventStore
{
[FunctionName("AddEventInEventStore")]
public static void Run([CosmosDBTrigger("db", "Items",
ConnectionStringSetting = "AzureWebJobsDocumentDBConnectionString",
LeaseCollectionName = "leases", LeaseDatabaseName = "db"
)]
IReadOnlyList<Document> changeList, TraceWriter log)
{
if (changeList != null && changeList.Count > 0)
{
log.Verbose("Documents modified " + changeList.Count);
foreach (var change in changeList)
{
log.Verbose("First document Id " + change.Id);
}
}
}
}
