Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FunctionIndexingException when missing ServiceBusConnectionString

I create the following program:

using System;
using Microsoft.Azure.WebJobs;

namespace StayUpdated.Cpe.PypyFilter
{
    public class Program
    {
        public static void Main()
        {
            var jobHost = new JobHost();
            jobHost.RunAndBlock();
        }

        public static void ProcessQueue([ServiceBusTrigger("start")] String input)
        {
        }
    }
}

In the app.config I add the following connection strings:

<add name="AzureWebJobsDashboard" connectionString="DefaultEndpointsProtocol=https;AccountName=cpepypywebjobstorage;AccountKey=2iCufOrnXeY/B/VJptegGXaAbEmoj1SOgiiAbunk1kDAPqhkgvcOj3NEVGqtm0363GHu/h6Fy8JfoWEpKCP2Rw==" />
<add name="AzureWebJobsStorage" connectionString="DefaultEndpointsProtocol=https;AccountName=cpepypywebjobstorage;AccountKey=2iCufOrnXeY/B/VJptegGXaAbEmoj1SOgiiAbunk1kDAPqhkgvcOj3NEVGqtm0363GHu/h6Fy8JfoWEpKCP2Rw==" />

I get a FunctionIndexingException exception with message, Error indexing method 'ProcessQueue'.

like image 919
Micah Zoltu Avatar asked May 24 '26 12:05

Micah Zoltu


1 Answers

This is caused by the lack of an AzureWebJobsServiceBus connection string. You must either add that connection string or manually connect a ServiceBusConnectionString via a JobHostConfiguration.

You can look at the inner exception on that exception and see that it is a ConfigurationErrorsException with a message:

Configuration is missing required information. Make sure the property 'Endpoint' is defined as part of 'Microsoft.ServiceBus.ConnectionString' key within 'appSettings' section, or Windows Azure configuration settings.

Unfortunately, following the instructions provided in the exception message will not work.

I believe the cause is because without the service bus connection string, the JobHost doesn't load whatever it needs to load in order to successfully parse the ServiceBusTrigger attribute.

It would be much better if the error you received was along the lines of,

Attempted to setup a ServiceBusTrigger without a ServiceBusConnectionString.

Even better would be to just log a warning that there are triggers that will never be hit and continue. One might want to have triggers setup but not always have a service bus connection string.

like image 97
Micah Zoltu Avatar answered May 26 '26 00:05

Micah Zoltu