首页 > 解决方案 > Azure 函数 Python - 错误“未注册绑定类型‘blobTrigger’”

问题描述

我试图在我的 Mac 上本地运行 Azure 函数并收到以下错误:The binding type(s) 'blobTrigger' are not registered. Please ensure the type is correct and the binding extension is installed.

我正在使用 homebrew ( )Python 3.6.8进行安装。azure-functions-core-toolsbrew tap azure/functions; brew install azure-functions-core-tools

使用预期的配置设置我的local.settings.json文件,因此函数应该侦听托管在 azure 中的正确存储容器。

我确定自从上周工作以来我没有更改任何代码或配置文件。

host.json 文件包含:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"
  }
}

function.json 文件包含:

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "xmlblob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "<directory>/{name}",
      "connection": "AzureStorageAccountConnectionString"
    }
  ]
}

requirements.txt 文件包含:

azure-cosmos==3.1.0
azure-functions-worker==1.0.0b6
azure-storage==0.36.0
azure-storage-blob==2.0.1
xmljson==0.2.0
xmlschema==1.0.11

然后我在终端中运行以下命令:

1) pip install -r requirements.txt
2) source .env/bin/activate
3) func host start

然后我收到以下错误:

<Application name>: The binding type(s) 'blobTrigger' are not registered. Please ensure the type is correct and the binding extension is installed.

标签: pythonazure-functionsazure-blob-storage

解决方案


从外观上看,您所做的一切都是正确的,但是您需要在本地安装 dotnet 核心框架和运行时才能执行触发器。

对于 Ubuntu 上的我来说,我遵循了这个指南。安装后,我能够在本地触发 blob 功能。

对于 Mac,我会在这里查看有关安装 dotnot core 的信息。


推荐阅读