Skip to content
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-Web : GZIP compressed response from .Net 3.1 gRPC service failing with browser (SPA JS client) unable to decode. #1141

Closed
MahalingamVenkat opened this issue Dec 6, 2020 · 2 comments
Labels
question Further information is requested

Comments

@MahalingamVenkat
Copy link

MahalingamVenkat commented Dec 6, 2020

We have a gRPC service (.Net core 3.1) with gRPC-Web middleware added to the pipeline. The client is a SPA written in Javascript (React) and the JS files are auto-generated with protoc tool.
When the response from this gRPC service is “GZip” compressed, the browser is not able to decompress the data. The gRPC-Web calls are failing with the below error:
Error seen in browser console: net::ERR_CONTENT_DECODING_FAILED 200 (Tried in both new Edge and Chrome)

Request-headers (specific to this issue):
accept-encoding: gzip, deflate, br
grpc-accept-encoding : gzip
content-type: application/grpc-web+proto (Tried with application/grpc-web-text also)

Response-headers (specific to this issue):
content-type: application/grpc-web
content-encoding: gzip
grpc-encoding: gzip

Question:
Does gRPC-Web in .Net supports GZIP with client written in JavaScript (JS files generated with protoc tool)? Any other additional changes to be done to support this compression?

JS files are generated from protoc tool. Even, with the greeter service provided in .net examples, we are facing the same issue.

We did a response size comparison between REST and gRPC calls from the client application and, due to this issue, we could see that GZIP JSON size is lesser than non-GZIP gRPC response.
We are not able to use the gzip compression in .Net service due to this issue.

Response with Number of records JSON (GZIP) Proto (GZIP) Proto (Not GZIP) – due to above issue
10K 354 kB 183 kB 550 kB
20K 417 kB 365 kB 1.5 MB
30K 624 kB 550 kB 2.3 MB
50K 1.0 MB 916 kB 3.9 MB

cc: @shirhatti

@MahalingamVenkat MahalingamVenkat added the question Further information is requested label Dec 6, 2020
@JamesNK
Copy link
Member

JamesNK commented Dec 6, 2020

Sounds like grpc-web JS client doesn't support compression - grpc/grpc-web#561. I don't know why grpc-web client includes grpc-accept-encoding: gzip when gzip compression is not supported.

@JamesNK
Copy link
Member

JamesNK commented Dec 14, 2020

Closing as answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants