Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection strings stored in K8s CSI Volumes are not resolved during function discovery #2552

Open
kjlimxxxx opened this issue Oct 15, 2024 · 0 comments
Labels

Comments

@kjlimxxxx
Copy link

Description

I have a function triggered by Service Bus connection strings.
There is an issue isolated worker process: the connection string stored in container secret storage are not resolved during function discovery, causing the function to fail.

Reproduction Steps

  1. Create an isolated Azure function project with a Service Bus trigger.
  2. Store the service bus connection string in the file path C:\mnt\secrets-store\ with a file named ServiceBusConnection.
  3. DO NOT include the connection string in the local.settings.json file.
  4. Update the Program.cs to load the secret:
    var host = new HostBuilder()
        .ConfigureFunctionsWebApplication()
        .ConfigureAppConfiguration((context, config) => {
            config.AddKeyPerFile("/mnt/secrets-store", false);
        })
        .Build();
    
    await host.RunAsync();
  5. Ensure the function uses the connection string:
    [Function(nameof(ServiceBus))]
    public async Task Run(
        [ServiceBusTrigger("myqueue", Connection = "ServiceBusConnection")]
        ServiceBusReceivedMessage message,
        ServiceBusMessageActions messageActions)
    {
        _logger.LogInformation("Message ID: {id}", message.MessageId);
        _logger.LogInformation("Message Body: {body}", message.Body);
        _logger.LogInformation("Message Content-Type: {contentType}", message.ContentType);
    
        // Complete the message
        await messageActions.CompleteMessageAsync(message);
    }
  6. Start the project.

Expected behavior

The function should start with the resolved connection string.

Actual behavior

Error Message: When the app starts, the following error occurs:

The listener for function 'Functions.ServiceBus' was unable to start. Microsoft.Azure.WebJobs.Extensions.ServiceBus: Service Bus account connection string with name 'ServiceBusConnection' does not exist in the settings. Make sure that it is a defined App Setting.

Regression?

NA

Known Workarounds

NA

Configuration

Which version of .NET is the code running on?
.NET 8

What OS and version, and what distro if applicable?

  1. Can be reproducible with Windows 10, x64.
  2. Observed the same issue in docker container - Linux

Other information

  1. This issue only occurs in the isolated worker process.
  2. The in-process model is working fine.
@kjlimxxxx kjlimxxxx added the bug label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant