azure function java CosmosDBTrigger-input and @SignalROutput-output, Error :Cannot create Collection Information

azure function java CosmosDBTrigger-input and @SignalROutput-output, Error :Cannot create Collection Information

我已经用占位符替换了安全数据

本地 运行 以及部署后出错 -

Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.<Function-Name>'. Microsoft.Azure.WebJobs.Extensions.CosmosDB: Cannot create Collection Information for <Collection-Name> in database <Database-Name> with lease <Lease-Collection-Name> in database <Database-Name> : 
RequestUri: https://<Azure-Cosmos-DB-Account>.mongo.cosmos.azure.com/;
RequestMethod: GET;
Header: x-ms-version Length: 10;
Header: User-Agent Length: 48;
Header: x-ms-date Length: 29;
Header: Authorization Length: 82;
, Request URI: /, RequestStats: , SDK: Windows/10.0.18362 documentdb-netcore-sdk/2.10.1. Microsoft.Azure.DocumentDB.Core: 

local.settings.json 文件 -

{
  "IsEncrypted": false,
  "Values": {
    "JAVA_OPTS": "-Djava.net.preferIPv4Stack=true -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:5005",
    "AzureWebJobsStorage": "<Required value>",
    "AzureWebJobsDashboard": "<Required value>",
    "AzureSignalRConnectionString": "<Endpoint connection string>",
    "AzureCosmosDBConnection": "AccountEndpoint=https://<Azure Cosmos Db Account>.mongo.cosmos.azure.com:443/;AccountKey=<Required key>",
    "FUNCTIONS_WORKER_RUNTIME": "java"
  },
  "Host": {
    "LocalHttpPort": 7071,
    "CORS": "http://localhost:8080,http://localhost:4200",
    "CORSCredentials": true
  }
}

代码-

@FunctionName("Notify-Update")
    public void notifyDBUpdate(
            @CosmosDBTrigger(name = "dataInput",
                    databaseName = "demo",
                    collectionName = "bagi",
                    leaseDatabaseName = "demo",
                    leaseCollectionName = "leasebagi",
                    createLeaseCollectionIfNotExists = true,
                    connectionStringSetting = "AzureCosmosDBConnection")
                    String document,
            @SignalROutput(name = "dataOutput", hubName = "chat", connectionStringSetting = "AzureSignalRConnectionString") OutputBinding<String> dataOutput,
            final ExecutionContext context) {

        context.getLogger().info("Java CosmosDB Notification trigger processed a request: " + document);

集合和数据库已经创建,但我还没有创建租约集合。

我正在使用 cosmos db、signalr 和 azure 函数开发实时应用程序,但我已经被这个错误困扰了很长一段时间。

您似乎正在使用 Mongo 帐户(您的端点是 <Azure-Cosmos-DB-Account>.mongo.cosmos.azure.com)。

根据 documentation:

Azure Cosmos DB bindings are only supported for use with the SQL API.