Grpc.Core.RpcException when remote invocation results in BadRequest
See original GitHub issueExpected Behavior
The client sdk should be able to handle HTTP 400 Bad Request and make the request available to the calling application
Actual Behavior
When the app returns a HTTP400 or BadRequest object the dapr client fails with an exception.
Steps to Reproduce the Problem
Small modification of https://github.com/dapr/dotnet-sdk/blob/master/samples/AspNetCore/ControllerSample/Controllers/SampleController.cs to add the following method to return a BadRequest
/// Do
[HttpPost("do")]
public IActionResult Do(int value)
{
Console.WriteLine($"Doing {value}");
return BadRequest(new
{
value = value
});
}
When calling the method on the client via
var a = await client.InvokeMethodAsync<object, Account>("routing", "do", data, httpExtension);
we are getting an exception
== APP == DepositUsingServiceInvocation
== APP == invoking
== APP == Unhandled exception. Grpc.Core.RpcException: Status(StatusCode=Internal, Detail="Bad Request")
== APP == at Dapr.Client.DaprClientGrpc.MakeGrpcCallHandleError[TResponse](Func`2 callFunc, CancellationToken cancellationToken) in /dotnet-sdk/src/Dapr.Client/DaprClientGrpc.cs:line 585
It seems there is no handling in the client sdk https://github.com/dapr/dotnet-sdk/blob/master/src/Dapr.Client/DaprClientGrpc.cs#L584
RELEASE NOTE: N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:32 (32 by maintainers)
Top Results From Across the Web
Exception when calling gRPC server from .Net Framework ...
TryParseRequest(ReadResult result, Boolean& endConnection) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.
Read more >Troubleshoot gRPC on .NET
Call insecure gRPC services with .NET Core client. The .NET gRPC client can call insecure gRPC services by specifing http in the server...
Read more >Namespace Grpc.Core | Google.Cloud.Asset.V1Beta1
A description of a remote method. RpcException. Thrown when remote procedure call fails. Every RpcException is associated with a resulting Status of the...
Read more >Implementing Microservices with gRPC and .NET Core 3.1
The gRPC framework proposes the RPC model, which is a model where a client invokes a remote procedure that will be executed on...
Read more >Handling gRPC exception correctly server side
Return an RpcException with the correct gRPC status code (depends on the type of exception handled). In the case of a RpcException, we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
moving back to dotnet-sdk. The fix for grpc-dotnet has been merged - https://github.com/grpc/grpc-dotnet/pull/1046 new version of grpc-dotnet will be released by this week or early next week. then we will use this version to fix this problem.
IMO we need to make sure we return the following information to the caller when invoking HTTP services, uniformly: