Florinator
Florinator

Reputation: 71

V2 Azure Function ServiceBusTrigger Not Working

I have a .NET Standard 2.0 project that defines Azure functions. I have a couple of BlobTrigger and QueueTrigger functions which work as expected. I am trying to replace the storage account QueueTrigger functions with ServiceBus topic trigger functions:

[FunctionName("CommandConsumer")]
public static async Task RunAsync([ServiceBusTrigger("commands", "active", Connection = "ServiceBus")]string commandJson, TraceWriter log)
{
    log.Info($"C# ServiceBus topic trigger function processed message: {commandJson}");
}

This function never gets triggered even though upstream functions add messages to the topic successfully (I can see that I have 25 messages on the topic right now), and my console window shows a lot of messages like these:

[9/13/2018 7:13:29 PM] MessageReceiver error (Action=Receive, ClientId=MessageReceiver1commands/Subscriptions/active, EntityPath=commands/Subscriptions/active, Endpoint=p.servicebus.windows.net)
[9/13/2018 7:14:06 PM] MessageReceiver error (Action=Receive, ClientId=MessageReceiver1commands/Subscriptions/active, EntityPath=commands/Subscriptions/active, Endpoint=p.servicebus.windows.net)
[9/13/2018 7:14:42 PM] MessageReceiver error (Action=Receive, ClientId=MessageReceiver1commands/Subscriptions/active, EntityPath=commands/Subscriptions/active, Endpoint=p.servicebus.windows.net)

I've set the tracing to Verbose but I can't get any more details about this MessageReceiver error.

Thank you in advance!

Edit: here are the project's relevant package references:

<PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.0-beta8" />
<PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="3.0.0-beta8" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.19" />

Upvotes: 2

Views: 1784

Answers (1)

Florinator
Florinator

Reputation: 71

We had made a mistake in our Azure templates and had duplicated keys for some KeyVault access keys, that caused the invocation of the Azure function to fail because of "Access Denied" to the KeyVault. Unfortunately the output window didn't show those inner exceptions when running locally, but when we ran the same code in Azure, we saw the exceptions in the Live Metrics Stream and were able to track down and fix the duplicate keys.

Upvotes: 3

Related Questions