Response parsing breaks with 'grpc-encoding: gzip'
See original GitHub issueWhen the gRPC response is gzipped (indicated by the grpc-encoding: gzip
response header), the grpc-web stream parser fails with this error (including the first few bytes for reference):
Uncaught Error: The stream is broken @0/0. Error: invalid frame byte. With input:
1,0,0,2,126,31,...
And the grpc-web filter in Envoy unfortunately automatically adds this request header when proxying to the gRPC server: grpc-accept-encoding:identity,deflate,gzip
, which in the case of akka-grpc at least causes the server to gzip. The envoy source code has a comment stating that this header ‘is required for gRPC’.
When I hacked akka-grpc to ignore the above header and not gzip, the response is properly parsed.
I’m a backend engr., but if someone can give me some pointers I could take a stab at fixing this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:14
Top Results From Across the Web
Gzip compression in response from gRPC-java to gRPC-web
But when I send compressed response my client fall with error 'Error in parsing response body'. And my response payload don't decompress with...
Read more >rpc_util.go - Google Git
"google.golang.org/grpc/encoding/proto" ... NewGZIPCompressor creates a Compressor based on GZIP. ... func recv(p *parser, c baseCodec, s *transport.
Read more >Chapter 4, gRPC: Under the Hood - O'Reilly
The service stub parses the message bytes into language-specific data structures ... The response message follows the same procedure that we observed on...
Read more >asp.net - GZip compression broken after three hard reloads
Filter = new GZipStream(context.Response.Filter, CompressionMode.Compress); context.Response.AppendHeader("Content-encoding", "gzip"); ...
Read more >Troubleshooting the GitLab agent for Kubernetes
... net/http: HTTP/1.x transport connection broken: malformed HTTP response ... Decompressor is not installed for grpc-encoding.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@stanley-cheung We are also facing similar issue with gzip compression not supported by grpc-web. Issue #1000 The protobuf payload is larger than the gzipped JSON payload and this adds to the increased response time. We are not able to move to grpc-web currently for our JS client to service calls due to this issue.
Any plans you could share on this gzip support being added in the near future? Or any other suggestions in terms of other compression that grpc-web supports or ways to mitigate the issue?
This cost me some hours. Here is a solution, a bit of code to get others started that run into this issue with Akka HTTP: