Skip to content

Cosmos Trigger does not start consumption app that has scaled all the way down #11308

@ntaylor-ads

Description

@ntaylor-ads

I have a python function app with two functions that use two CosmosDB triggers to ingest data for the rest of the app. The data stream is not continuous with traffic for only a couple hours once a day. The function app runs correctly on initial start and then correctly scales to zero once the traffic subsides. The issue is that the app never restarts the following day once the traffic resumes. If I then manually start the app (for example, by connecting to the live telemetry) is scales up and correctly resumes processing on the change feed until it eventually scales to zero again.

Please provide the following:

  • Function App version: 4.1042.100.2
  • Region: West Europe and East US 2

Both function apps have func.json's that look like the following (with different values behind the redactions.

{
    "scriptFile": "__init__.py",
    "bindings": [
        {
            "name": "documents",
            "type": "cosmosDBTrigger",
            "direction": "in",
            "connection": "<REDACTED>CosmosConnection",
            "databaseName": "<REDACTED>",
            "containerName": "<REDACTED>",
            "leaseConnection": "COSMOS_CONNECTION_STRING",
            "leaseDatabaseName": "<REDACTED>Data",
            "leaseContainerName": "ingestLeases",
            "leaseContainerPrefix": "<REDACTED>",
            "createLeaseContainerIfNotExists": true
        }
    ]
}

Where CosmosConnection is referencing the following app setting:

<REDACTED>CosmosConnection__accountEndpoint   =  "https://<database_account_name>.documents.azure.com:443/"

Expected behavior

The cosmos trigger should continue to function even after the app has scaled all the way down. Upon changes in the monitored cosmos container, it should scale up the function app.

Actual behavior

The function app never starts.

Known workarounds

I haven't tried these yet, but I assume creating a "keep-alive" timer function that runs every ~10 mins or creating a health endpoint that is regularly pinged by an external system would keep the function app alive and, therefore, the cosmos trigger would continue to function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions