我只是在 Azure 门户中创建一个新的 CosmosDBTrigger 并将其连接到我的 Cosmos DB。没有改变任何东西。只需遵循默认的 example .
当我运行它时,我收到此问题标题中的文本异常。这是完整的日志:
Exception while executing function: Functions.Test
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.Test ---> System.InvalidOperationException : Exception binding parameter 'documents' ---> System.InvalidOperationException : Unable to convert trigger to CosmosDBTrigger.
at Microsoft.Azure.WebJobs.Extensions.DocumentDB.CosmosDBTriggerBinding.BindAsync(Object value,ValueBindingContext context)
at async Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.BindCoreAsync[TTriggerValue](ValueBindingContext context,Object value,IDictionary`2 parameters)
End of inner exception
at Microsoft.Azure.WebJobs.Host.Executors.DelayedException.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,CancellationTokenSource functionCancellationTokenSource)
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)
End of inner exception
这很奇怪。我记得一个月前也做过同样的事。好像最近有什么东西坏了。谷歌搜索特定消息会给出上个月的三个无用结果。
我能做什么?当一切正常时,我可以切换到某个以前的版本吗?
最佳答案
@psfinaki 你 cannot RUN the cosmos trigger从Azure 门户,您必须创建或更新受监视集合中的文档才能运行触发器。
在 Cosmos DB 触发器的 Azure 门户中不应存在或应禁用 RUN 选项,因为它与直接支持“RUN”选项的其他类型的触发器选项不同。
关于c# - Azure函数: Unable to convert trigger to CosmosDBTrigger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48862833/