question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Service Bus Extensions: Potential issue with entity path for subscriptions

See original GitHub issue

Library name and version

Microsoft.Azure.WebJobs.Extensions.ServiceBus 5.1

Describe the bug

I have created a web job function for service bus topic trigger ,as I obtain the connection string from azure (the connection string will contain a entity path).

I have looked into the source code of service bus and found out, during the ServiceBusTriggerAttributeBindingProvider is creating ServiceBusListener, it is using EntityNameFormatter.FormatSubscriptionPath(topicName, subscriptionName) to build a entity path in a format of “{topic-name}/Subscription/{subscription-name}”

so I trace it back to this method CreateBatchMessageReceiver() is having the issue, when it is creating the client.CreateReceiver(entityPath, options)),

if you look at the override of that method, it treats the entitypath as queue name.

Shouldn’t it be using

CreateReceiver(string topicName, string subscriptionName, ServiceBusReceiverOptions options);

Expected behavior

CreateReceiver(string topicName, string subscriptionName, ServiceBusReceiverOptions options);

Actual behavior

CreateReceiver(string queueName, ServiceBusReceiverOptions options);

Reproduction Steps

as described in the description

Environment

windows 10, dotnet 6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JoshLove-msftcommented, Feb 16, 2022

I was able to repro the issue - it looks like it is related to the call that you pointed out @superwalnut. Since we use the receiver overload for creating the message receiver, we end up validating that the subscription name is the same as the topic name from the entityPath section of the connection string, which of course it isn’t. As a workaround, you can remove the entityName from your connection string. Thanks for reporting this!

0reactions
superwalnutcommented, Feb 16, 2022

Thank you Josh for fixing it up. At the mean time we will be using the single message trigger, till you guys address this issue. The connection string is from terraform directly obtained from azure key vault, so for the best not to fiddle with the connection string manually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

service bus binding does not accept EntityPath as connect ...
You'll need to workaround the issue using one of the approaches mentioned above (use connection string for service bus namespace, or use ARM ......
Read more >
Troubleshooting Service Bus issues
Troubleshooting Service Bus issues. This troubleshooting guide covers failure investigation techniques, common errors for the credential types in the Azure ...
Read more >
Azure Service Bus client library for .NET
A client responsible for sending ServiceBusMessage to a specific Service Bus entity (Queue or Topic). It can be used for both session and...
Read more >
How to use Azure Service Bus topics with PHP
In this article. This article shows you how to use Service Bus topics and subscriptions. The samples are written in PHP and use...
Read more >
azure-servicebus
Create Service Bus namespaces, queues, topics, and subscriptions, and modify their settings. Send and receive messages within your Service Bus channels. Utilize ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found