-
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: Handle streaming backend error cases correctly #8315
Comments
FYI the behavior of the first case (streaming error with flag set) is a bug. The This can be verified by adding the following test case to
|
Here is what happens in case of a trailer-only streaming error: Well, we can fix that. There is no need to ask the transcoder for data if we know that it's a trailers-only response. |
When a streaming backend returns an error in a trailer-only response, with the 'convert_grpc_status' option enabled, instead of writing the [] (empty array) in reply-body transcode the error in the headers and reply with {"code":...}. Risk Level: Low Testing: added an integraion test, tested manually. Documentation: n/a Release notes: n/a Fixes envoyproxy#8315 Signed-off-by: Anatoly Scheglov <[email protected]>
When a streaming backend returns an error in a trailer-only response, with the 'convert_grpc_status' option enabled, instead of writing the [] (empty array) in reply-body transcode the error in the headers and reply with {"code":...}. Risk Level: Low Testing: added an integraion test, tested manually. Documentation: n/a Release notes: n/a Fixes #8315 Signed-off-by: Anatoly Scheglov <[email protected]>
…#8323) When a streaming backend returns an error in a trailer-only response, with the 'convert_grpc_status' option enabled, instead of writing the [] (empty array) in reply-body transcode the error in the headers and reply with {"code":...}. Risk Level: Low Testing: added an integraion test, tested manually. Documentation: n/a Release notes: n/a Fixes envoyproxy#8315 Signed-off-by: Anatoly Scheglov <[email protected]>
…#8323) When a streaming backend returns an error in a trailer-only response, with the 'convert_grpc_status' option enabled, instead of writing the [] (empty array) in reply-body transcode the error in the headers and reply with {"code":...}. Risk Level: Low Testing: added an integraion test, tested manually. Documentation: n/a Release notes: n/a Fixes envoyproxy#8315 Signed-off-by: Anatoly Scheglov <[email protected]>
The grpc-json-transcoder filter does not handle errors from streaming backends correctly. I opened this issue to document the current and proposed downstream responses.
Note that #8009 introduced a new
convert_grpc_status
flag to deduce the HTTP response code and body from the gRPC backend error. This flag introduces another edge case (below).I think the logic for unary responses is OK. I've only seen these issues with streaming backends.
cc @qiwzhang
cc @ascheglov
Streaming Error with flag set
Configuration: The backend returns a gRPC error via a trailer-only response. The filter is configured with
convert_grpc_status=true
.Current Behavior
The filter returns a HTTP 200 OK. The grpc status flag is set in one of the response headers. Assuming that #8312 will be merged in, the response will be
[]
with content-typeapplication/json
.Proposed Behavior
The filter should return a response that matches the unary case with
convert_grpc_status
set:Streaming Error without flag
Configuration: The backend returns a gRPC error via a trailer-only response. The filter is configured without
convert_grpc_status
(default behavior).Current Behavior
Same as above: The filter returns a HTTP 200 OK. The grpc status flag is set in one of the response headers. Assuming that #8312 will be merged in, the response will be
[]
with content-typeapplication/json
.Proposed Behavior
The filter should return a response that exposes the error:
Other Notes
I would prefer to get #8312 merged in first to fix the content type issue. Please advise on how to handle this, as it may be a breaking change (?)
The text was updated successfully, but these errors were encountered: