【发布时间】:2019-03-01 21:56:55
【问题描述】:
我正在定义一个 Azure Function App,如下所示:
public static void Run(
[CosmosDBTrigger(
databaseName: "dbName",
collectionName: "collectiontoMonitor",
ConnectionStringSetting = "collectionConnectionStringSettingName",
LeaseDatabaseName = "LeaseDBName",
LeaseCollectionName = "LeaseCollection",
LeaseConnectionStringSetting = "LeaseConnectionString",
LeaseCollectionPrefix ="funcName")]IReadOnlyList<Document> input, ILogger log)
{
..
}
我是从 Visual Studio 发布的,它可以正常工作,没有任何错误。但是,即使在 Collection 发生更改后,也不会触发该函数。 如果我手动运行该函数,我会收到错误:
Value cannot be null. Parameter name: o
以上是确切的错误消息,我没有任何名为“o”的参数。我可能会错过什么。
更新:如果有影响,Function App 与 Cosmos 的订阅不同。
【问题讨论】:
-
你有剩余的堆栈跟踪吗?
-
您是否检查过您的连接字符串是否设置正确?
-
它们在 AppSettings 中定义。我检查了几次,它们看起来是正确的。
-
@ChrisAnderson-MSFT BTW,他们在不同的订阅下。
-
你不能手动运行函数,这是一个触发器,只要集合发生变化就会运行。手动运行函数适用于 HttpTrigger 之类的东西。您看到的错误是因为当您在 Functions Portal 中使用 Run 时,您没有发送预期的文档批次。您是否在
App Settings中定义了LeaseConnectionString和collectionConnectionStringSettingName?您是否有任何其他功能以完全相同的配置运行(本地或云中)?
标签: azure-functions azure-cosmosdb cosmosdbtrigger