0

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?

Arash
  • 3,628
  • 5
  • 46
  • 70
  • Maybe in environment section AzureWebJobsStorageQueue should be AzureWebJobsStorage? – Kai Walter Mar 11 '21 at 06:24
  • Can you show the code? What is the trigger of your durable function? – Cindy Pau Mar 11 '21 at 07:36
  • @BowmanZhu I updated the details by reflecting the code and the service dependency. Please review this StackOverflow post again. Thanks. – Arash Mar 11 '21 at 12:23
  • No connection key be setted? – Cindy Pau Mar 11 '21 at 12:25
  • @BowmanZhu You are right. No connection key. – Arash Mar 11 '21 at 12:25
  • So does the problem come from this? – Cindy Pau Mar 11 '21 at 12:27
  • @BowmanZhu I have a feeling that AzureWebJobsStorageQueue is not picked up due to some reasons. There are two separate function apps in the container so that I have to use AzureWebJobsStorageQueue for this durable function. Even I removed the other function app and used the default AzureWebJobsStorage environment but the problem persists. I have no idea where the problem is coming from. – Arash Mar 11 '21 at 12:29
  • Try to add AzureWebJobsStorageQueue, `[QueueTrigger("queuename", Connection = "AzureWebJobsStorageQueue")]`, If you don't use trigger to set the connection string, please not use `Connection = ""` – Cindy Pau Mar 12 '21 at 01:44
  • @BowmanZhu trying soon and keep you posted. – Arash Mar 12 '21 at 01:50
  • I tried your suggestion by `[QueueTrigger("queuename", Connection = "AzureWebJobsStorageQueue")]` and also `[QueueTrigger("queuename", Connection = "%AzureWebJobsStorageQueue%")]` but none of them worked. – Arash Mar 12 '21 at 12:56
  • Can you help to guide how to deploy Durable Function to Docker container? – kate Mar 19 '22 at 12:57

0 Answers0