connectrpc / envoy-demo

Demonstration of how to use the new Connect-gRPC Envoy filter, available in Envoy v1.26+.
Apache License 2.0
25 stars 7 forks source link

Transcode plaintext to binary requests #17

Closed lmondada closed 7 months ago

lmondada commented 7 months ago

Thank you for your great work and great project.

I have a betterproto+grpclib server backend (i.e. in Python) and was having a hard time debugging grpc-web requests as all communications were binary. I switched to connectRPC, motivated by the much better support for typescript browser code and plaintext requests.

However, after setting up the connect <-> gRPC envoy bridge as demonstrated in this repo, I have realised that plaintext connect requests are not transcoded to binary gRPC. My backend does not support JSON requests, so I am stuck using connect with binary format, thus losing the benefits from using connect in the first place.

Is adding a feature request in envoy to support this transcoding in the bridge the right approach? Do you know of a way to solve this in the short term, e.g. plugging in some additional envoy filter in the stack? I've tried using Envoy's grpc json transcoder, but without success.

emcfarlane commented 7 months ago

Hi Imondada, transcoding the descriptor from json to proto is currently not supported. The issue being that it would require the descriptors to perform the translation. A trade off was made to keep the implementation simple as usually adding JSON support for servers is easy to add, in go for instance this is a one liner. You may be interested in vanguard-go which is a go library that can act as a reverse proxy and supports translation.

lmondada commented 7 months ago

Thanks Ed, that makes sense. I will look into adding JSON support to my python stack then :)