Node Serverless and Azure Service Bus

Hi, i’m trying to make un function that listen a Azure service bus queue, i used the example given here : https://serverless.com/framework/docs/providers/azure/events/servicebus/

But, after deploying on Azure, when i go to my function i have this message :
Error:
Function error (email) : The binding type(s) ‘serviceBusTrigger’ are not registered. Please ensure the type is correct and the binding extension is installed.

And of course my function don’t work.

Here is my serverless.yml :

service: email-consumer

provider:
  name: azure
  location: West Europe

plugins:
  - serverless-azure-functions

package:
  exclude:
    - .idea/**
    - node_modules/**
    - .gitignore
    - .git/**

functions:
  email:
    handler: handler.email
    events:
      - serviceBus:
        x-azure-settings:
          name: item
          queueName: email-send-request
          accessRights: listen
          connection: ServiceBusConnection

package.json :

{
  "name": "email-consumer",
  "version": "0.1.0",
  "description": "email consumer",
  "main": "handler.js",
  "author": "Dysnomia",
  "license": "UNLICENSED",
  "dependencies": {
    "serverless-azure-functions": "^0.7.0"
  }
}

email-function.json :

{
    "disabled": false,
    "bindings": [
        {
            "type": "serviceBusTrigger",
            "direction": "in",
            "name": "item",
            "queueName": "email-send-request",
            "connection": "ServiceBusConnection",
            "accessRights": "listen"
        }
    ],
    "entryPoint": "email",
    "scriptFile": "handler.js"
}
1 Like

I noticed that the Azure Functions project had a bug regarding the service bus connection settings. This occurs when using servicebus triggers and has nothing to do with the serverless framework. Were you able to get this working since? I am trying to modify local.settings.json to get around the issue as suggested on Azure forums but it’s still not quite working for me. The error I get in the Azure console after deployment is: Error:

The function runtime is unable to start. Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string ‘Endpoint=sb://blahblahblah-sbn.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;[Hidden Credential]’ is missing or empty.
Session Id: e74c5c88d77b489397cb10b25155f483
Timestamp: 2020-03-05T19:26:15.664Z

add a host.json file with this content at your project level.
{
“version”: “2.0”,
“extensionBundle”: {
“id”: “Microsoft.Azure.Functions.ExtensionBundle”,
“version”: “[1.*, 2.0.0)”
}
}

Fyi, it appears that the extensionBundle should be wrapped in an extensions property like this:

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