-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
grpc-json transcoder: convert grpc-message to body in response #3383
Comments
No, currently Envoy's grpc-json filter doesn't support converting grpc-message into body. This will be a feature request that we can work in future. |
I too have the same problem using the grpc-json transcoder. I am trying to figure out on how to send the Error Response as part of Body for RestClient to consume. Can you please put this on priority and there are will be lot of Rest Clients that are consuming our GRPC calls via envoy transcoder. |
Switching over to help wanted / feature request. |
I've looked at this a bit. 2 caveats here:
TL;DR: if To mitigate this, one cloud use
Perhaps there is a way to fix such behavior, but it does not look easy/obvious at least to me. The other workaround would be to buffer body inside
|
@baranov1ch Thanks for investigating on this.
Aside from that, to be more clear, I think the grpc-message would be converted into http body iff the response is trailer-only. If we already converted some of body, then it will be in header for unary and (unfortunately with the possibility to be swallowed) in trailer for streaming case.
|
Will always buffering the body (received from
in this case possible custom details (which are |
I think that is fine, it should match what addDecodedData for decoder path as well.
Are you trying to translate (non-well-documented) |
Yes. While it is indeed non-documented, C-based runtimes and grpc-go use it for serializing status with non-empty details, so de-facto it will work in most cases. Do you think it does not worth doing? |
I've run into this issue as well. This issue makes handling error messages with REST clients quite inconvenient. There are two aspects to providing error details to REST clients:
ESP handles both of these quite well. It would be great if this can be supported by Envoy as well. What's the timeline for supporting this? |
I've run into this issue as well. We want to develop our APIs in gRPC following Google's API Design Guide, which allows us to use gRPC internally and expose a consistent REST interface to our customers (perhaps we expose gRPC as well in the future). As described in the section on errors, error responses are mapped to HTTP+JSON response of following structure (note the status object is nested in another object with {
"error": {
"code": 401,
"message": "Request had invalid credentials.",
"status": "UNAUTHENTICATED",
"details": [{
"@type": "type.googleapis.com/google.rpc.RetryInfo",
...
}]
}
} Can we count on having similar behavior in Envoy proxy? |
+1 on better support for errors. I too am following the Google API Design Guide and using envoy to transcode grpc-json. Having error details in http headers isn't very nice. A serialised Status object would be much nicer for our http1 friends! (Would happily sponsor someone to implement this, if that's allowed) |
@shaneqld +1, feel free to open a PR for this. |
A few design questions:
|
I'd add another options in the filter config, but not in printOptions.
No. |
…xy#3383) When trailer indicates a gRPC error and there was no HTTP body, with the convert_grpc_status option enabled, take google.rpc.Status from the grpc-status-details-bin header and use it as a JSON body. If there was no such header, make google.rpc.Status out of the grpc-status and grpc-message headers. This also adds google.rpc.Status to user-provided protobuf descriptor. Risk Level: Small-medium Testing: Added unit and integration tests tests, tested manually. Docs Changes: Added field description in api/envoy/config/filter/http/transcoder/v2/transcoder.proto Release Notes: Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
…8009) When trailer indicates a gRPC error and there was no HTTP body, with the `convert_grpc_status option` enabled, take `google.rpc.Status` from the `grpc-status-details-bin` header and use it as a JSON body. If there was no such header, make `google.rpc.Status` out of the `grpc-status` and `grpc-message` headers. This also adds `google.rpc.Status` to user-provided protobuf descriptor. Risk Level: Small-medium Testing: Added unit and integration tests tests, tested manually. Docs Changes: Added field description in api/envoy/config/filter/http/transcoder/v2/transcoder.proto Release Notes: Fixes #3383 Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
…xy#3383) (envoyproxy#8009) When trailer indicates a gRPC error and there was no HTTP body, with the `convert_grpc_status option` enabled, take `google.rpc.Status` from the `grpc-status-details-bin` header and use it as a JSON body. If there was no such header, make `google.rpc.Status` out of the `grpc-status` and `grpc-message` headers. This also adds `google.rpc.Status` to user-provided protobuf descriptor. Risk Level: Small-medium Testing: Added unit and integration tests tests, tested manually. Docs Changes: Added field description in api/envoy/config/filter/http/transcoder/v2/transcoder.proto Release Notes: Fixes envoyproxy#3383 Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
…xy#3383) (envoyproxy#8009) When trailer indicates a gRPC error and there was no HTTP body, with the `convert_grpc_status option` enabled, take `google.rpc.Status` from the `grpc-status-details-bin` header and use it as a JSON body. If there was no such header, make `google.rpc.Status` out of the `grpc-status` and `grpc-message` headers. This also adds `google.rpc.Status` to user-provided protobuf descriptor. Risk Level: Small-medium Testing: Added unit and integration tests tests, tested manually. Docs Changes: Added field description in api/envoy/config/filter/http/transcoder/v2/transcoder.proto Release Notes: Fixes envoyproxy#3383 Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
…xy#3383) (envoyproxy#8009) When trailer indicates a gRPC error and there was no HTTP body, with the `convert_grpc_status option` enabled, take `google.rpc.Status` from the `grpc-status-details-bin` header and use it as a JSON body. If there was no such header, make `google.rpc.Status` out of the `grpc-status` and `grpc-message` headers. This also adds `google.rpc.Status` to user-provided protobuf descriptor. Risk Level: Small-medium Testing: Added unit and integration tests tests, tested manually. Docs Changes: Added field description in api/envoy/config/filter/http/transcoder/v2/transcoder.proto Release Notes: Fixes envoyproxy#3383 Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Title: Envoy's grpc-json transcoder
Description:
The text was updated successfully, but these errors were encountered: