Search code examples
azureazure-functionsazure-functions-runtimeazure-storage-accountazure-functions-core-tools

Azure functions event hub trigger binding registration failing when deploying code from storage account


Event hub trigger binding registration failing when deploying the code from zipped code in a storage account using the app setting, WEBSITE_RUN_FROM_PACKAGE. Giving the following error:

The binding type(s) eventHubTrigger are not registered

The same code works fine when unzipped deployed through VS code.

Host.json

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

Function.json

{
  "bindings": [
    {
      "type": "eventHubTrigger",
      "name": "myEventHubMessage",
      "direction": "in",
      "eventHubName": "eventHubName",
      "connection": "myEventHubReadConnectionAppSetting"
    }
  ]
}

Solution

  • Update the host.json and Add "extensions"

    {
    "version": "2.0",
    
    "extensions": {
        "blobs": {},
        "cosmosDb": {},
        "durableTask": {},
        "eventHubs": {},
        "http": {},
        "queues": {},
        "sendGrid": {},
        "serviceBus": {}
    },
    
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[2.*, 3.0.0)"
    }}