首页 > 解决方案 > Cosmos DB 触发器绑定未注册?

问题描述

我设置了一个简单的天蓝色函数 cosmos 触发器,如下所示:

{
  "bindings": [
    {
      "type": "cosmosDBTrigger",
      "name": "documents",
      "direction": "in",
      "leaseCollectionName": "leases",
      "connectionStringSetting": "DbConnectionString",
      "databaseName": "mydb",
      "collectionName": "mycollection",
      "createLeaseCollectionIfNotExists": "true"
    }
  ],
  "scriptFile": "../dist/TestCosmosTrigger/index.js"
}

当我运行该函数时,出现错误:

“TestNotifier”函数出错:绑定类型“cosmosDBTrigger”未注册。请确保类型正确并安装了绑定扩展。

不知道我做错了什么,也许是 nodejs azure 函数中的错误?

编辑:在我的计算机上更新 azure 功能工具后,现在一大堆其他绑定已经开始失败,并出现相同的错误,例如 signalr:

{“类型”:“signalRConnectionInfo”,“名称”:“connectionInfo”,“hubName”:“聊天”,“userId”:“{headers.authorization}”,“方向”:“in”}

未安装 signalRConnectionInfo 绑定扩展。

标签: node.jstypescriptazure-functionsazure-cosmosdbazure-functions-core-tools

解决方案


使用以下命令更新 azure 功能核心工具后:

npm i -g azure-functions-core-tools@core --unsafe-perm true

然后运行:

func extensions install -p Microsoft.Azure.WebJobs.Extensions.SignalRService -v 1.0.0

看起来上述问题已解决,出现了一个新问题,但这是一个单独的问题。


推荐阅读