question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set the DaprClient invoke timeout

See original GitHub issue

How to set the DaprClient invoke timeout

I have an API that takes 2 minutes to complete, but the DaprClient invoke will time out after 100 seconds.

System.Threading.Tasks.TaskCanceledException: 'The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.'
   at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
   at System.Net.Http.HttpClient.<<SendAsync>g__Core|83_0>d.MoveNext()
   at Dapr.Client.DaprClientGrpc.<InvokeMethodWithResponseAsync>d__24.MoveNext()
   at Dapr.Client.DaprClientGrpc.<InvokeMethodAsync>d__26`1.MoveNext()
   at Program.<<Main>$>d__0.MoveNext() in C:\Users\John\source\repos\DaprGround\Invoke.Client\Program.cs:line 17

Issue Analytics

  • State:open
  • Created 8 months ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
halspangcommented, Feb 1, 2023

@johnseed - Thanks for bringing this up. We do need a way to expose this, which would probably be best done by exposing the actual factory/creation method. I’ll discuss it with some of the other active people in the repo.

In the meantime, since you’re using a direct http invoke, you can also do this with a raw HttpClient. Then you’d have full control over it, but you’d need to construct the endpoint yourself.

0reactions
BartNetJScommented, Apr 14, 2023

I’m looking also into this to use the HttpClientFactory to inject middleware like for example an exception logger middleware

for example: A factory functions like this

Func<HttpClient> factory = () =>
{
    var httpClientHandler = new HttpClientHandler();
    var loggingMiddleware = new LogInternalServerErrorMiddleware(httpClientHandler);

    return new HttpClient(loggingMiddleware);
};

And pass it to UseHttpClientFactory(Func<HttpClient> factory)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started with the Dapr client .NET SDK
You can either use the DaprClient or System.Net.Http.HttpClient to invoke your services. SDK; HTTP. using var client = new DaprClientBuilder().
Read more >
The Dapr service invocation building block
Invoke gRPC services using DaprClient. Invoke HTTP services using HttpClient. The preferred way to call an HTTP endpoint is to use Dapr's rich ......
Read more >
Dapr Integration with Azure Container Apps - Part 4
The first thing to try out here is to run the Backend Web API using Dapr, from VS Code open a new PowerShell...
Read more >
Dapr for .NET Developers - GitHub
Install Dapr into your local environment . ... Invoke gRPC services using DaprClient . ... A timeout is interpreted as a failure.
Read more >
DaprClient (dapr-sdk-parent 1.9.0 API)
Invoke a service method, using serialization. <T> reactor.core.publisher.Mono<T>, invokeMethod​(String appId, String methodName ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found