'Cannot create leases container (Gremlin API) with /id as partition key, but comos db trigger requires /id as partition key

I am trying to create a cosmos db trigger for Gremlin API, since the trigger requires partition key as /id, I am not able to create it either from settings in trigger itself (createLeaseCollectionIfNotExists) nor from the azure portal, since it partition key cannot be either /id or /label.

is there any work around for the same, either creating a timer trigger using change feed to look for partition key I have specified in Gremplin API containers or any configuration changes in the api/containter itself

Error Message:

The 'CosmosTrigger' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.CosmosTrigger'. Microsoft.Azure.WebJobs.Extensions.CosmosDB: Cannot create Collection Information for Contacts in database GraphDB with lease leases in database GraphDB : Partition key path /id is invalid for Gremlin API. The path cannot be '/id', '/label' or  a nested path such as '/key/path'

function.json:

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "type": "cosmosDBTrigger",
      "name": "documents",
      "direction": "in",
      "leaseCollectionName": "leases",
      "connectionStringSetting": "DOCUMENTDB",
      "databaseName": "GraphDB",
      "collectionName": "Contacts",
      "createLeaseCollectionIfNotExists": true
    }
  ]
}


Solution 1:[1]

If any of the collections in the target account inside the provided database do not exist, the error message will appear.

  • Make sure the Connection String points to the correct account and that the collections are visible in the database
  • For this, with your connection string you can browse Cosmos Explorer you can use the Azure Portal,

A Firewall rule (either Virtual Network or IP rules) of your account prevents access to your current workstation.

  • Check the Account to see if there is a rule preventing your access. You can either disable or add your current IP address to the Firewall rule.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SuryasriKamini-MT