Closed toefel18 closed 5 years ago
Yes this is expected behavior and known limitation of gRPC JSON transcoding, there's no way for HTTP/1.1 to change response code after server started body, in gRPC the status is included in trailers but that isn't supported in HTTP/1.1
I understand.
But if the grpc service immediately responds with an error before sending any content, Envoy could detect that before it starts sending the response headers. Is that possible?
Also: should the response content type not be application/json
instead of application/grpc
?
Ah sorry I misread this a bit. If upstream is sending trailer only response, then envoy should be able to convert that. I will take more look later.
@lizan Ok nice :+1:
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
@kh-chang Do you have time to look at this issue
I will take a look at it soon.
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.
any update on this issue?
+1
@lizan @qiwzhang should this be reopened?
@dio you can reopen this and assign to me.
Bug Template
Title: grpc-json transcoder always returns 200 OK with response body
[]
when rpc return type is streamDescription: The grpc-json transcoder always returns 200 OK with response body
[]
when rpc return type is of type stream. If the gRPC api returns an error or throws an exception, it still returns 200 with body '[]'. The response content-type is always'application/grpc
(for successful and unsuccessful calls).Expected behaviour: The response content type should be application/json and errors should be reflected in the status code.
Repro steps: I came across this issue while writing a blog post about Envoy and grpc transcoding. Please just focus on the
ListReservations
rpc for reproduction.Complete working exampe transcoding-grpc-to-http-json
reservation_service.proto file:
ListReservations Java implementation
generating service descriptor
Running envoy using docker
successful cal
Call in which the gRPC service throws an exception
Call in which the gRPC service calls responseObserver.onError(UNAUTHENTICATED)
Admin and Stats Output:
/clusters
/server_info
*/stats
Config:
Logs:
Call Stack: