Skip to content

Connection string environment variable is required even if the connection string is provided another way #232

@mikeminutillo

Description

@mikeminutillo

This package loads a connection string from an environment variable which by default is named AzureWebJobsServiceBus (but this can be overridden in the constructor for ServiceBusTriggeredEndpointConfiguration).

This is not the only way to set the transport connection. It can also be set like this:

var endpointConfiguration = new ServiceBusTriggeredEndpointConfiguration("MyEndpoint");
endpointConfiguration.Transport.ConnectionString(myConnectionString);

Unfortunately this fails as the endpoint still attempts to load the connection string from an environment variable, even if there is one. This code attempts to set the connection string to null which results in an exception:

NServiceBus.Core: Value cannot be null. (Parameter 'connectionString').

Workaround

To workaround this problem, a connection string must be available in the Azure Function environment variables and the ServiceBusTriggeredEndpointConfiguration should be configured to use this environment variable. Note that the connection string does not need to be for a valid ServiceBus account as it will not be used.

Expected Behavior

It should be possible to set the connection string on the transport without setting an environment variable.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions