5
votes

I have an Azure Function with a Cosmos DB trigger configured to auto-create a lease collection on-demand, I get the following error when running against a Cosmos DB with throughput configured at database level

[30/11/2018 23:33:04] Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.Foo'. Microsoft.Azure.WebJobs.Extensions.CosmosDB: Cannot create Collection Information for X in database Y with lease leases in database Y : Shared throughput collection should have a partition key

Works absolutely fine when the throughput is solely configured at container level. Also tried manually creating a lease collection and setting id as the partition key (given from my other DB it looked like all a lease has was an id / ttl) but then it complains about the PK not being provided.

Any ideas?

2

2 Answers

8
votes

EDIT : this is now supported with the version 3.0.3 of the Microsoft.Azure.WebJobs.Extensions.CosmosDB NuGet package. Tested and works fine with Azure Functions 2.0.


James, this is being supported soon, the PR is already being reviewed to add Partitioned Lease Collections, please see https://github.com/Azure/azure-webjobs-sdk-extensions/pull/520

At this moment the version of the Change Feed Processor library used in Azure Functions does not support partitioned lease collections, the latest version does, so part of that PR is updating the library dependency.

This is mostly common on Shared RU at the Database level.

3
votes

Please take a look at the Function Output - configuration Please note that this is for version 2.0 of Azure Function bindings for Cosmos DB.

Azure Cosmos DB bindings for Azure Functions 2.x