Unable to run .net core app Azure Durable Functions v3 in docker

402 views Asked by At

I am trying to implement a docker-compose.yml file to build a container for a .net core Azure Durable Function v3. The following code snippet is from the environment file i.e. .env:

AzureWebJobsStorage=MyConnectionString
AzureWebJobsDashboard=MyConnectionString
AzureWebJobsStorageQueue=MyAnotherConnectionString

This is how a part of the docker-compose file looks like:

  local.mydurablefunction:
    image: ${DOCKER_REGISTRY-}myfunction
    build:
      context: .
      dockerfile: src/MyFunction/Dockerfile
    ports:
      - 34080:34080   
    environment:
      - AzureWebJobsStorageQueue
      - AzureWebJobsDashboard
      - AzureWebJobsStorageQueue

When running docker-compose up I get the following error message:

fail: Host.Startup[515] A host error has occurred during startup operation 'd8e39085-bed2-4f30-b80b-37d2fe1b286d'. System.InvalidOperationException: Unable to find an Azure Storage connection string to use for this binding. at Microsoft.Azure.WebJobs.Extensions.DurableTask.AzureStorageDurabilityProviderFactory.GetAzureStorageOrchestrationServiceSettings(String connectionName, String taskHub

This is how the function looks like:

[FunctionName("MyTrigger")]
        public async Task RunAsync(
            [QueueTrigger("queuename", Connection = "")] string metadataPayload,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log,
            CancellationToken cancellationToken)
{
}

Somewhere in the function's body, we are calling a durable task which looks like the following code snippet:

[FunctionName("Orchestrator")]
public async Task RunOrchestratorAsync(
    [OrchestrationTrigger] IDurableOrchestrationContext context,
    [DurableClient] IDurableOrchestrationClient orchestrationClient,
    ILogger log)
{
}

And this is the service dependency definition:

{
  "dependencies": {
    "storage1": {
      "type": "storage",
      "connectionId": "AzureWebJobsStorageQueue"
    }
  }
}

What is the solution for this problem or what may be missing in this configuration? Could it be due to not being able to copy the environment variables to the container?

0

There are 0 answers