部署时,CosmosDB 触发器失败,并出现以下错误“函数‘x’的侦听器无法启动。侦听器已启动。”

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

我需要使用

StartFromTime
,因为我们需要将历史数据种子从 Cosmos 数据库上传到将运行的目标数据库,然后更改源处理器将在该过程完成后启动。

一旦我实现了

StartFromTime
,我部署的代码就开始失败并出现此错误。 “函数‘x’的监听器无法启动。监听器已经启动。”

添加此属性是我唯一的更改。

在本地运行这个效果很好。

我删除了我的租赁记录,它们没有重新创建自己。

这是我的更改提要功能。

[FunctionName("XChangeFeedProcessor")]
public async Task Run([CosmosDBTrigger(
    databaseName: "%cosmosDbName%",
    containerName: "X",
    Connection = "ConnectionStrings:CosmosDB",
    LeaseContainerName = "XLeaseCollection",
    LeaseContainerPrefix = "%leaseContainerPrefix%",
    CreateLeaseContainerIfNotExists = true,
    StartFromTime = "%startFromTime%")]IReadOnlyCollection<JObject> documents)

这是我的调用堆栈

Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException:
System.InvalidOperationException:
   at Microsoft.Azure.WebJobs.Extensions.CosmosDB.CosmosDBTriggerListener`1+<StartAsync>d__26.MoveNext (Microsoft.Azure.WebJobs.Extensions.CosmosDB, Version=4.4.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: D:\a\_work\1\s\src\WebJobs.Extensions.CosmosDB\Trigger\CosmosDBTriggerListener.cs:91)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener+<StartAsync>d__13.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.39.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs:68)

我将所有 nuget 包更新到最新并部署,但这没有帮助。

我在没有 StartFromTime 的情况下重新部署,该功能按预期工作。

https://github.com/Azure/azure-webjobs-sdk-extensions/issues/817没有帮助我

cosmosdbtrigger
1个回答
0
投票

事实证明,微软技术支持可以在应用程序洞察中看到比我更多的日志。这是为什么?!

我用于部署到 StartFromTime 函数配置的二头肌文件的日期格式为 2020-01-01T00:00:00Z,但部署后,该格式转换为 2020/01/01 00:00:00并且该函数无法解析它。一旦技术支持向我显示错误,我手动更新了日期并且它工作正常。我正在向 Microsoft 填写有关此问题的错误报告。

© www.soinside.com 2019 - 2024. All rights reserved.