简体   繁体   中英

Function was unable to start. Microsoft.Azure.DocumentDB.Core: PartitionKey value must be supplied for this operation.?

I have a simple azure function cosmos trigger set up, like so:

{
  "bindings": [
    {
      "type": "cosmosDBTrigger",
      "name": "documents",
      "direction": "in",
      "leaseCollectionName": "leases",
      "connectionStringSetting": "DbConnectionString",
      "databaseName": "mydb",
      "collectionName": "mycollection",
      "createLeaseCollectionIfNotExists": "true"
    }
  ],
  "scriptFile": "../dist/TestCosmosTrigger/index.js"
}

When I run the function I get an error:

The listener for function 'Functions.FeedNotifier' was unable to start. Microsoft.Azure.Documents.ChangeFeedProcessor: Host was already initialized.

I did try to add a partitionKey field to th ebindings to no avail.

Seems to be related to this issue . Try with single-partition lease collection and also mentioned here

Please update to the latest Microsoft.Azure.WebJobs.Extensions.CosmosDB dependency package .

This error either means you have a partitioned leases collection that is not partitioned by /id or you are using an old extension version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM