Skip to content

Grpc.Core.RpcException when remote invocation results in BadRequest #399

@denniszielke

Description

@denniszielke

Expected 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

Metadata

Metadata

Labels

P1kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions