![](/img/trans.png)
[英]The listener for function 'Functions.trigger' was unable to start? while running Azure function locally
[英]Azure Functions Trigger Failed: A listener for function was unable to start
我正在创建一个带有 cosmos db 触发器的 azure 函数,我使用了 Visual Studio 代码 azure 工具来创建它,并生成了以下代码:
public static class offers_trigger
{
[Function("items_trigger")]
public static void Run([CosmosDBTrigger(
databaseName: "dev",
collectionName: "items",
ConnectionStringSetting = "dev_DOCUMENTDB",
LeaseCollectionName = "leases")] IReadOnlyList<MyDocument> input, FunctionContext context)
{
var logger = context.GetLogger("items_trigger");
if (input != null && input.Count > 0)
{
logger.LogInformation("Documents modified: " + input.Count);
logger.LogInformation("First document Id: " + input[0].Id);
}
}
}
但是当我尝试在本地启动它时,它会生成以下错误:
The listener for function 'Functions.items_trigger' was unable to start. Microsoft.Azure.DocumentDB.Core: Sql api is not supported for this database account
ActivityId: 773dae99-5e4e-45f7-a54f-4c5b0dbaf5a8, Microsoft.Azure.Documents.Common/2.14.0, Darwin/10.15 documentdb-netcore-sdk/2.12.0.
有人可以帮我吗?
您使用 Cosmos DB Binding for SQL API 和您指定的 Cosmos DB 帐户不支持 SQL API。 更多信息在这里
我们有一个类似的问题,它在某个时间点开始出现,而我们的函数应用程序没有任何更改。 我们能够通过将“Microsoft.Azure.WebJobs.Extensions.CosmosDB”nuget 包升级到最新版本 (3.0.10) 来解决此问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.