我有一个简单的 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:主机已经 初始 化。
我确实尝试将分区键字段添加到绑定中,但无济于事。
似乎与这个问题有关。尝试使用single-partition lease collection
,也在这里提到
请更新到最新的Microsoft.Azure.WebJobs.Extensions.CosmosDB
依赖项包。
此错误表示您有一个未按/id
分区的分区租约集合,或者您使用的是旧的扩展版本。