【问题标题】:Azure Functions Trigger Failed: A listener for function was unable to startAzure Functions 触发器失败:函数的侦听器无法启动
【发布时间】:2021-09-30 01:05:59
【问题描述】:

我正在使用 cosmos db 触发器创建一个 azure 函数,我使用了 Visual Studio Code 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.

谁能帮帮我?

【问题讨论】:

    标签: azure azure-functions azure-cosmosdb azure-triggers


    【解决方案1】:

    您使用 Cosmos DB Binding for SQL API 和您指定的 Cosmos DB 帐户不支持 SQL API。更多信息here

    【讨论】:

      【解决方案2】:

      我们遇到了类似的问题,它在某个时间点开始出现,而我们的函数应用没有任何更改。我们能够通过将“Microsoft.Azure.WebJobs.Extensions.CosmosDB”nuget 包升级到最新版本 (3.0.10) 来解决此问题

      【讨论】:

        猜你喜欢
        • 2020-11-04
        • 1970-01-01
        • 2023-02-03
        • 2021-11-30
        • 2018-06-28
        • 2022-08-05
        • 1970-01-01
        • 1970-01-01
        • 2015-08-30
        相关资源
        最近更新 更多