Sorry, I forgot to mention that we route requests to grpc endpoints nginx, which means that Nginx itself probably fails to send response with >4Kb of headers. So a more precise question would be: is it possible to send an error in response body rather than in header?
On Thursday, January 20, 2022 at 1:52:47 PM UTC+3 Denis Babochenko wrote: > Hello everyone! I couldn't find a solution on google so I'm posting here: > > We have a project which uses grpc-web for handling requests to a Java > server from a browser client (this decision was driven by usage of Protobuf > for api code generation). Therefore, requests and responses are wrapped > into HTTP/2. Whenever server throws an exception, I wrap it into a Status ( > https://github.com/googleapis/googleapis/.../status.proto > <https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto>), > > where details is an exception wrapped into Any. This is usually a complex > exception with multiple links to different entities and so on. > > An error in the response is sent not in the body, but in the > "grpc-status-details-bin" > header, which is why, if the error is a long binary string (>4Kb), total > header size gets too large, and I assume that grpc-web cuts the message > down, as It says at https://github.com/grpc/grpc/.../PROTOCOL-HTTP2.md > <https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md>: > > > Servers may limit the size of *Request-Headers*, with a default of 8 > KiB suggested. Implementations are encouraged to compute total header size > like HTTP/2's SETTINGS_MAX_HEADER_LIST_SIZE: the sum of all header fields, > for each field the sum of the uncompressed field name and value lengths > plus 32, with binary values' lengths being post-Base64. > > So, the question is: is there any known workaround for responding with big > error messages? I've thought about streaming chunked errors, but the OK > response is not streamed in most cases > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/41f69e46-4632-45b2-be77-6b26adb4b3b8n%40googlegroups.com.
