Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service invocation with gorilla mux http handler not returning body for status code 4xx or 5xx #365

Open
unnsteinngardars opened this issue Feb 21, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@unnsteinngardars
Copy link

unnsteinngardars commented Feb 21, 2023

Describe the bug
I have a service A and a service B. Service A is invoking a method in B. I can successfully invoke the method and when the gorilla mux http handler that is the callee sets the status code as 4xx or 5xx along with some data in response body, the response in the caller is empty. However when the callee sets the status code as 2xx, the data in the response body is non empty in the caller.

I have tried to directly invoke the method using GET http://localhost:3500/v1.0/invoke/app-id/method/method-name when setting the status code as 4xx or 5xx in the callee, and in that case the response data is returned correctly.

So this must be some bug in the go sdk.

To Reproduce
Create a service A which invokes a method in service B, write a http handler in service B using gorilla mux (I am creating the dapr service with mux like the docs explain) and set a status code of 4xx or 5xx along with some response data, the response data will be empty in the eyes of the caller.

Expected behavior
I expect that the response data is returned no matter the status code set in the callee.

@unnsteinngardars unnsteinngardars added the bug Something isn't working label Feb 21, 2023
@unnsteinngardars unnsteinngardars changed the title service invocation with gorilla mux http handler not returning body for status code > 200 service invocation with gorilla mux http handler not returning body for status code 4xx or 5xx Feb 21, 2023
@Taction
Copy link
Member

Taction commented Apr 1, 2023

@unnsteinngardars Thanks for reporting this issue! Can you please try the latest dapr and SDK version? I haven't reproduced this using github.com/dapr/go-sdk v1.7.0 and the newest dapr version, so this issue may have been fixed.

@unnsteinngardars
Copy link
Author

unnsteinngardars commented Apr 12, 2023

@unnsteinngardars Thanks for reporting this issue! Can you please try the latest dapr and SDK version? I haven't reproduced this using github.com/dapr/go-sdk v1.7.0 and the newest dapr version, so this issue may have been fixed.

@Taction That does not seem to work. Are you not able to reproduce this? In my case, when I return a successful status code, the only thing that is returned from InvokeMethod is the response body, no status code, no headers, nothing else.

When I return an unsuccessful status code (400 for example) I get an empty response from InvokeMethod but the status code is reflected in the error returned by InvokeMethod like this (rpc error: code = Internal desc = Bad Request)

Is it not correctly assumed that I should receive the HTTP response including body, status code and headers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants