Azure Functions Trigger Failed: A listener for function was unable to start


Author: Bruno Dias

Originally Sourced from: https://stackoverflow.com/questions/68490108/azure-functions-trigger-failed-a-listener-for-function-was-unable-to-start

I'm creating an azure function with a cosmos db trigger, i used the visual studio code azure tools to create it and it generated the following code:

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);
            }
        }
    }

But when I try to start it locally, it generates the following error:

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.

Can anyone help me please?