dapr / dotnet-sdk

Dapr SDK for .NET
Apache License 2.0
1.11k stars 337 forks source link

AddDaprSecretStore always times out #983

Open lsoft-bho opened 1 year ago

lsoft-bho commented 1 year ago

I have services deployed in Azure Container Apps with Dapr enabled. I'm trying to add a secrret store to the configuration like this:

builder.Services.AddDaprClient();

if (!string.IsNullOrEmpty(builder.Configuration["SecretStore"]))
{
    var timeout = builder.Configuration.GetValue("DaprSidecarTimeout", 5);
    using var sp = builder.Services.BuildServiceProvider();
    builder.Configuration.AddDaprSecretStore(builder.Configuration["SecretStore"], sp.GetRequiredService<DaprClient>(), TimeSpan.FromSeconds(timeout));
}

This works locally running with docker compose, but in the container app this always creates the following exception:

Unhandled exception. System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Dapr.Client.DaprClientGrpc.WaitForSidecarAsync(CancellationToken cancellationToken)
at Dapr.Extensions.Configuration.DaprSecretStore.DaprSecretStoreConfigurationProvider.LoadAsync()
at Dapr.Extensions.Configuration.DaprSecretStore.DaprSecretStoreConfigurationProvider.Load()
at Microsoft.Extensions.Configuration.ConfigurationManager.AddSource(IConfigurationSource source)
at Microsoft.Extensions.Configuration.ConfigurationManager.Microsoft.Extensions.Configuration.IConfigurationBuilder.Add(IConfigurationSource source)
...

I have tried with timeouts of up to one minute.

Is there some configuration I am missing that I should have set?

m1t0k commented 1 year ago

I had the same issue, fixed in docker-compose.yml file by adding network_mode:

test-api: ... ... test-api-dapr: ..... depends_on:

lsoft-bho commented 1 year ago

Thank you for your answer @m1t0k, but you misunterstood my problem. It is working with docker-compose - it is not working in Azure Container Apps.

WhitWaldo commented 3 weeks ago

@lsoft-bho Are you still experiencing this issue? ACA should be running a few newer versions than they were when you first reported the issue and I'm hopeful that between their update and this PR, this issue is now resolved.