-
Notifications
You must be signed in to change notification settings - Fork 0
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
Inconsistent gRPC-Web behavior #15
Comments
As an aside, I believe, while gRPC-Web is supported by FauxRPC, CORS is not. Is that correct? The consequence is that gRPC-Web clients except browsers are supported. |
I don't have time to dig deeply into this right this moment, but I can throw a couple suggestions:
I can easily add CORS support in to make this easier. You could theoretically use a load balancer to serve up a UI and FauxRPC with the same host. In which case, CORS doesn't really matter or you could have the load balancer serve up the CORS headers... but I can see how that can be extra work, so this is a good feature to add directly to FauxRPC. Can you make a different github issue for that to track it separately? |
Thanks for the feedback and suggestions; I'll give them a whirl. I'm running the Web server and FauxRPC on localhost; CORS rears its head because of the different ports, I'd thought? I'll open an issue for CORS support. |
I'm out of my depth with rust, but I believe we might learn more about this issue from debugging this |
I've found the issue. tonic-web appears to be parsing the trailers wrong in some cases... it's seeing an extra space with FauxRPC. This is basically what the trailers look like from FauxRPC: grpc-message:
grpc-status: 0 The tonic_web server does this: grpc-status:0 You don't see it in your output because it's not actually printing the raw trailers. Note the spaces after the separating colon Thanks for this issue though, this has been a fun learning experience! 🦀 |
I filed a PR for tonic. From my testing it fixes your issue 😀 |
Wow! Thank you very much. I saw the PR. I'll try it out. It makes sense that they're only testing against Rust (tonic) servers. Does this explain why the Rust client worked with Connect's public Eliza service? |
Because this is only an issue with HTTP/1.1 and I think the Rust client would connect using HTTP/2 with demo.connectrpc.com. HTTP/2 has binary framing which is much more strict so this isn't an issue there. The usual behavior for HTTP clients is to never use HTTP/2 on non-TLS connections. This, however, can be forced by using a feature called "h2c" (sometimes referred to as |
Oh wait, I'm actually wrong about HTTP/2 here. Even with HTTP/2, gRPC-Web trailers are passed in the body... so your question still stands at why the behavior is different. I will note that FauxRPC actually uses Vanguard to enable gRPC/gRPC-Web/Connect/REST protocols... So the implementation is actually different. gRPC-Web trailers may be different between ConnectRPC and Vanguard. |
Using
tonic-web
with any (but e.g.ElizaService
)client.rs
(as-is URL changes aside) against FauxRPC:Error: Status { code: Unknown, message: " ", source: None }
Even though
fauxrpc run --addr=localhost:6660 --schema=eliza.binpb
:Reconfiguring the rust client to use
https://demo.connectrpc.com
:Response { metadata: MetadataMap { headers: {"content-type": "application/grpc-web", "grpc-accept-encoding": "gzip", "vary": "Origin", "date": "Thu, 14 Nov 2024 19:46:39 GMT", "server": "Google Frontend", "traceparent": "00-6d243811558d7e0f0f15a46b4cefb357-60228e18328eeff4-01", "x-cloud-trace-context": "6d243811558d7e0f0f15a46b4cefb357/6927255411427831796;o=1", "via": "1.1 google", "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000", "transfer-encoding": "chunked"} }, message: SayResponse { sentence: "How do you feel when you say that?" }, extensions: Extensions }
In the latter case, I'm having to rewire the client to use TLS too but, using
tailscale serve --https=443 6660
, I can put a TLS proxy in front of FauxRPC too and continue to receive:Error: Status { code: Unknown, message: " ", source: None }
All the while FauxRPC reports success (200) on the
POST /.../ElizaService/Say
.This suggests there's something inconsistent in FauxRPC's behavior that's not present in ConnectRPC.
I've been flummoxed by this.
I used Kreya because it supports gRPC-Web and it works correctly with both the ConnectRPC and FauxRPC endpoints.
Yesterday, I used
socat
to try and capture the traffic using thetonic-web
'shelloworld.proto
against FauxRPC.With minor differences, there's no obvious (to me breaking) difference:
client.rs
generates theError
:Kreya responds with
Ok
:The text was updated successfully, but these errors were encountered: