簡體   English   中英

Azure 函數觸發器失敗:函數的偵聽器無法啟動

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM