dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

Invoke with method containing query string needs to be /?

Open penfold opened this issue 3 years ago • 7 comments

Expected Behavior

The method parameter passed to DaprClient.InvokeMethod***Async with query parameters should work with 'method?param1=123'.

Actual Behavior

Using 'method?param1=123' leads to an internal error reported back

Using the method parameter method/?param1=123' works.

Steps to Reproduce the Problem

CLI version: 1.7.1 Runtime version: 1.7.4

penfold avatar Jul 06 '22 10:07 penfold

@penfold - Thanks for opening this issue! Can you please paste the error you get here?

halspang avatar Jul 07 '22 22:07 halspang

@penfold - I tried to repro this and found it works fine for me:

Calls:

➜  ~/Projects/TestBed/TestBed.Web git:(master) ✗ 
$ curl 'http://localhost:22222/api/service/testParam?test=123'                           
➜  ~/Projects/TestBed/TestBed.Web git:(master) ✗ 
$ curl 'http://localhost:60541/v1.0/invoke/testbed/method/api/service/testParam?test=456'

App response:

== APP == info: TestBed.Web.Controllers.ServiceController[0]
== APP ==       Received: 123
== APP == info: TestBed.Web.Controllers.ServiceController[0]
== APP ==       Received: 456

Code:

[HttpGet("testParam")]
public Task TestParam([FromQuery] string test)
{
    logger.LogInformation($"Received: {test}");
    return Task.CompletedTask;
}

What does your endpoint setup look like?

halspang avatar Jul 12 '22 14:07 halspang

My endpoint was a POST with boolean query params and a JSON body.

Called from a console app using DaprClient - not curl.

All using .net 6.

I'll add an exact repo when I'm back from annual leave next week.

Thanks.

penfold avatar Jul 18 '22 20:07 penfold

@penfold - Are you able to provide a repro for this?

halspang avatar Aug 29 '22 22:08 halspang

Having the same issue but with the following query string

filter[policy]=12345 @halspang

ekjuanrejon avatar Feb 15 '23 17:02 ekjuanrejon

@penfold @ekjuanrejon Are you still running into this issue? I've successfully used both method?name=value and method/?name=value in InvokeMethodAsync() calls, for both GET and POST methods, with the latest (1.11.0) version of the Dapr Client SDK.

If either of you are still having issues, could you post a more complete repro?

philliphoff avatar Sep 21 '23 19:09 philliphoff

Reverted to using http client.

ekjuanrejon avatar Sep 21 '23 20:09 ekjuanrejon