Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Functions not working with Queue Trigger

Tags:

Thanks in advance to anyone that can help.

I'm creating the following function in Azure with a queue trigger.

[FunctionName("SubmitJob")]
public static async Task Run(
       [ServiceBusTrigger("jobs", Connection = "AzureStorage")]string queueItem,
       TraceWriter log,
       IBinder binder)
{
    // Code Here
}

As soon as try and debug in visual I get the error below and the host keeps restarting.

[09/07/2018 16:06:20] Host initialized (325ms)
[09/07/2018 16:06:20] Host lock lease acquired by instance ID '0000000000000000000000005CC4C4A2'.
[09/07/2018 16:06:20] A ScriptHost error has occurred
[09/07/2018 16:06:20] System.Private.Uri: Value cannot be null.
[09/07/2018 16:06:20] Parameter name: uriString.
[09/07/2018 16:06:20] Stopping Host

I am using Azure Functions 2. If I comment out the function in my solution the host starts ok, and it is now just an empty function to rule out anything else out.

Any ideas on where to look would be appreciated.

like image 937
Lenny D Avatar asked Jul 09 '18 16:07

Lenny D


People also ask

How does Azure function queue trigger work?

Use the queue trigger to start a function when a new item is received on a queue. The queue message is provided as input to the function. A C# function can be created using one of the following C# modes: In-process class library: compiled C# function that runs in the same process as the Functions runtime.

Why is my Azure not triggering?

The most common cause for Azure Functions not getting triggered is that triggers are not synced properly. You can sync triggers in one of three ways: Restart your function app in the Azure portal.

Can Azure function have two triggers?

An Azure function can have multiple triggers, but the function must be explicitly configured to use multiple triggers. The Azure function can have a single trigger, or it can have multiple triggers.


1 Answers

Ok,

If anyone else come across this I used the template generator to add the function and this used the ServiceBusTrigger attribute. I guess this needs it's own configuration.

If you want to use your Azure Storage Queue use QueueTrigger Attribute instead.

Thanks again for anyone looking into this.

like image 123
Lenny D Avatar answered Oct 06 '22 01:10

Lenny D