serverless-azure-functions icon indicating copy to clipboard operation
serverless-azure-functions copied to clipboard

serviceBusQueue sample does not consume messages

Open psurma opened this issue 5 years ago • 6 comments

This is a Bug Report

Description

  • What went wrong? Deploying the serviceBusQueue example does not work as expected.
  • What did you expect should have happened? The function defined should be invoked when a message is sent to the service bus queue.
  • What was the config you used?
  serviceBusQueue:
    handler: src/handlers/serviceBusQueue.printMessage
    events:
      - serviceBus:
        x-azure-settings:
          name: item # Specifies which name is available on `context`
          queueName: tester # Name of the service bus queue to consume
          connection: tester_SERVICEBUS # App Setting/environment variable variable which contains Service Bus Namespace Connection String
          accessRights: listen

  • What stacktrace or error message from your provider did you see? No errors or activity

Similar or dependent issues:

none

Additional Data

I create a ServiceBus Queue manually and a Shared Access Policy for (Listen) in the Service Bus Namespace. I used the Primary Connection String as the Application Configuration Value for tester_SERVICEBUS

  • Serverless Framework Version you're using: 1.74.1
  • Serverless CLI Version you're using:
  • Serverless Azure Plugin Version you're using: 1.0.2
  • Operating System: darwin
  • Stack Trace: none
  • Provider Error messages:

psurma avatar Jul 03 '20 08:07 psurma

Hi Pete - did you find a solution to this problem at all? We're seeing identical behaviour with topics rather than queues. I had a chat with a Microsoft support chap last night who couldn't immediately see the problem, but what was strange was that he couldn't see the functions from my function app which were configured to trigger from the service bus. My gut feeling is that the problem isn't related to this plugin, because our packaged zip file looks fine, and it gets posted up to the zipdeploy endpoint which is supposed to guarantee the re-syncing of triggers. Pulling my hair out a little here now though. I'll post back here if I find the underlying problem.

jimmythomson avatar Aug 06 '20 09:08 jimmythomson

Hi Pete - did you find a solution to this problem at all? We're seeing identical behaviour with topics rather than queues. I had a chat with a Microsoft support chap last night who couldn't immediately see the problem, but what was strange was that he couldn't see the functions from my function app which were configured to trigger from the service bus. My gut feeling is that the problem isn't related to this plugin, because our packaged zip file looks fine, and it gets posted up to the zipdeploy endpoint which is supposed to guarantee the re-syncing of triggers. Pulling my hair out a little here now though. I'll post back here if I find the underlying problem.

Hi Jimmy, unfortunately no, I did not get to the bottom of this and eventually abandoned serverless. Using the Azure plugin for Visual Studio Code worked fine for me, so I just went with that.

psurma avatar Aug 06 '20 09:08 psurma

@tbarlow12 - Any initial ideas here? Potential issue w/ the x-azure-settings?

In v2.0 version the x-azure-settings was deprecated but still supported for backwards compatibility. Try removing this node from your yaml config.

wbreza avatar Aug 06 '20 16:08 wbreza

hi guys - I'm having all sorts of problems with azure functions/c#/serviceBus (the latest being "Error: Binding x-azure-settingsTrigger not supported")

"Deploying the serviceBusQueue example does not work as expected." Any ideas where that sample is?? tia

ianrandell-sh avatar Nov 05 '20 10:11 ianrandell-sh

Just for reference, we found the source of the problem when we were experiencing this issue, and it was down to an incorrect host.json config. Here's the working contents:

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

For some reason, we had missed the extensions property wrapping the extensionBundle property.

jimmythomson avatar Nov 05 '20 10:11 jimmythomson

thanks @jimmythomson - Ill fix that - I also have that "extensions" prop missing.

However, for my immediate "Error: Binding x-azure-settingsTrigger not supported" problem, I think Ive found the solution by debugging the transpiled js. It looks like the yaml need to be "serviceBus: true" rather than just "serviceBus" as per the docs:

So for me this does NOT work (results in "Error: Binding nameTrigger not supported"):

functions:
  myFunc:
    handler: myFunc.Run
    events:
      - serviceBus:
        name: message
        queueName: myQueueName
        connection: SERVICE_BUS_CONNECTION

but this DOES work:

functions:
  myFunc:
    handler: myFunc.Run
    events:
      - serviceBus: true # <--- NEED THIS
        name: message
        queueName: myQueueName
        connection: SERVICE_BUS_CONNECTION

I have wasted hours on this :-(

ianrandell-sh avatar Nov 05 '20 11:11 ianrandell-sh