Azure Function 的 Azure Cosmos DB 模拟器错误

问题描述 投票:0回答:1

我在不同的线程上发现了这个错误,但我还没有看到解决方案。我在 Windows 11 上使用 Azure Cosmos DB 模拟器。并且我使用 Azure 函数作为触发器。碰巧当我更改了数据库名称参数时,我在启动函数时收到此错误:

2023-12-26T17:16:04.200Z] Starting the listener for prefix='', monitoredContainer='business_docs_02', monitoredDatabase='cosmicworks_02', leaseContainer='leases_docs', leaseDatabase='cosmicworks_02', functionId='Host.Functions.MyCoFunc2' failed. Exception: System.InvalidOperationException: This builder instance has already been used to build a processor. Create a new instance to build another.
[2023-12-26T17:16:04.205Z]    at Microsoft.Azure.Cosmos.ChangeFeedProcessorBuilder.Build()
[2023-12-26T17:16:04.211Z]    at Microsoft.Azure.WebJobs.Extensions.CosmosDB.CosmosDBTriggerListener`1.StartProcessorAsync() in D:\a\_work\1\s\src\WebJobs.Extensions.CosmosDB\Trigger\CosmosDBTriggerListener.cs:line 140
[2023-12-26T17:16:04.214Z]    at Microsoft.Azure.WebJobs.Extensions.CosmosDB.CosmosDBTriggerListener`1.StartAsync(CancellationToken cancellationToken) in D:\a\_work\1\s\src\WebJobs.Extensions.CosmosDB\Trigger\CosmosDBTriggerListener.cs:line 96.
[2023-12-26T17:16:04.216Z] The listener for function 'Functions.MyCoFunc2' was unable to start.
[2023-12-26T17:16:04.217Z] The listener for function 'Functions.MyCoFunc2' was unable to start. Microsoft.Azure.Cosmos.Client: This builder instance has already been used to build a processor. Create a new instance to build another.
azure-functions azure-cosmosdb
1个回答
0
投票

您可以将触发器的这些属性设置为如下所示吗,

LeaseContainerName = "leases", CreateLeaseContainerIfNotExists = true
    
© www.soinside.com 2019 - 2024. All rights reserved.