grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.56k stars 762 forks source link

Getting code 2 http at 400 or 500 level GRPC web #1175

Closed onthegit closed 2 years ago

onthegit commented 2 years ago

Hello,

when I use GRPC web from web browser (chrome) it works fine.

However when I try to use it via the mobile browser on my phone (firefox mobile 95) it returns code 2 http at 400 or 500.

Strange thing is that when I use GRPC via Chrome on my desktop Envoy logs the requests properly, but when I try via firefox mobile no requests are logged by Envoy and the error returned is code 2 .

Code is transpiled to es5.

What could be the problem?

code for generating the js files: protoc -I=. file.proto --js_out=import_style=commonjs,binary:. --grpc-web_out=import_style=commonjs+dts,mode=grpcweb:.

grpc-web 1.2.1 envoy version 1.20 protoc-gen-go v1.27.1 protoc v3.19.1

sampajano commented 2 years ago

Thanks for the error report! :)

This is interesting.. I wonder if you could reproduce the same error using the same version of Firefox on desktop? If so, maybe you could try to capture the exact request/response and try to see how is it different from that made from Chrome?

Thanks.. :)

onthegit commented 2 years ago

@sampajano Thanks for your reply. I tested it too with Chrome Mobile version 96 and the same error is returned, and no requests are logged by Envoy.

Will get the request/response so that you can see it. Thanks.

onthegit commented 2 years ago

Ok, problem found.

it was ERR_TUNNEL_CONNECTION fail and this is probably due to some misconfigured transparent proxy of the Internet Provider (no proxies on the phone or the mobile browsers). I tried it with other Internet provider and grpc web works on my mobile phone. Thanks for the effort you put into the library

Thanks a lot.

sampajano commented 2 years ago

You're very welcome! :)

Oh very interesting to learn! Glad you've figured this out! 😃

Thank you for being an engaging user too! 😃