【问题标题】:Function was unable to start. Microsoft.Azure.DocumentDB.Core: PartitionKey value must be supplied for this operation.?函数无法启动。 Microsoft.Azure.DocumentDB.Core:必须为此操作提供 PartitionKey 值。?
【发布时间】:2020-02-15 14:34:33
【问题描述】:

我设置了一个简单的 azure 函数 cosmos 触发器,如下所示:

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

当我运行该函数时出现错误:

函数“Functions.FeedNotifier”的侦听器无法 开始。 Microsoft.Azure.Documents.ChangeFeedProcessor:主机已经 初始化。

我确实尝试在绑定中添加 partitionKey 字段,但无济于事。

【问题讨论】:

    标签: node.js typescript azure azure-functions azure-cosmosdb


    【解决方案1】:

    似乎和这个issue有关。试试single-partition lease collection,还提到了here

    【讨论】:

    • 我看了那些链接,还是不知道该怎么办?如何尝试单分区租约收集?
    【解决方案2】:

    请更新到最新的Microsoft.Azure.WebJobs.Extensions.CosmosDB依赖package

    此错误意味着您有一个未按/id 分区的分区租约集合,或者您使用的是旧的扩展版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-23
      • 2016-01-19
      • 1970-01-01
      • 2016-05-14
      • 2022-07-16
      相关资源
      最近更新 更多