azure-functionsazure-cosmosdbazure-functions-runtimeazure-cosmosdb-changefeed

Azure Functions - Cosmos DB Trigger Listener Unable to Start


I'm experiencing an issue with an Azure Function App named 'fa-store-ticket' that contains a function called 'CosmosTrigger1'. The runtime stack is Node ~18, running on Windows, and the operating mode is set to Consumption.

Here's the function.json configuration:

{
    "bindings": [
        {
            "type": "cosmosDBTrigger",
            "name": "documents",
            "direction": "in",
            "leaseCollectionName": "leasesStoreTickets",
            "connectionStringSetting": "database-mdb_DOCUMENTDB",
            "databaseName": "STORE_POS",
            "collectionName": "storeTickets",
            "createLeaseCollectionIfNotExists": true
        }
    ]
}

And here's the function's index.js:

module.exports = async function (context, documents) {
    context.log('Prueba');
}

When running the function, I'm getting the following logs in Application Insights:

7/27/2023, 11:46:31.821 PM
The listener for function 'Functions.CosmosTrigger1' was unable to start.
7/27/2023, 11:46:31.730 PM
Retrying to start listener for function 'Functions.CosmosTrigger1' (Attempt 2)
7/27/2023, 11:46:29.572 PM
Host lock lease acquired by instance ID '{websiteInstanceId}'.
7/27/2023, 11:46:27.934 PM
The listener for function 'Functions.CosmosTrigger1' was unable to start.
7/27/2023, 11:46:27.772 PM
Retrying to start listener for function 'Functions.CosmosTrigger1' (Attempt 1)
7/27/2023, 11:46:25.839 PM
Host Status: { "id": "fa-store-ticket", "state": "Running", "version": "4.23.0.20886", "versionDetails": "4.23.0+eeacf7e92eafab538714da022f610810a252f36d", "platformVersion": "100.0.7.442", "instanceId": "ffb36bd0b4e8606c3d02b60790248fe9ad51747a9ac80fb7cc625589efab50b4", "computerName": "10-30-0-23", "processUptime": 252763, "functionAppContentEditingState": "Unknown", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "3.24.0" } }
7/27/2023, 11:46:25.774 PM
Job host started

The error message I'm receiving is "The listener for function 'Functions.CosmosTrigger1' was unable to start.". The system also retries to start the listener without success.

I've checked the Cosmos DB connection string, and it seems to be correct. Furthermore, the Cosmos DB database is operating normally.

Does anyone have an idea about what might be causing this issue or where I should look next to troubleshoot it?


Solution

  • The listener for function 'Functions.CosmosTrigger1' was unable to start.

    I also tried and faced the same error which you got.

    enter image description here

    enter image description here

    Added name as connectionStringSetting and value as cosmos DB account connection string and save.

    enter image description here

    enter image description here

    Output:

    enter image description here

    Check this SO link for reference.