Working rust Grpc examples

Can anyone suggest some grpc examples that really work? what I find on the internet doesn't work or generates protobuf errors.

Examples of what?

example rust grpc client/server code that actually works

Have you tried using tonic for gRPC stuffs? Check out a few of their examples if you're interested. You will need protoc.

1 Like

So far I am stuck on
error: failed to run custom build command for prost-build v0.10.1

The example I am using is GitHub - swiftdiaries/rust-grpc-example: A minimal Rust based gRPC client and server (using tonic-rs) which is several years old.

No problems building grpc clients and servers in Java, just not Rust

I tried //github.com/hyperium/tonic/tree/master/examples

and building project results in
error: failed to run custom build command for uuid1 v0.1.0 (/Users/bihaber/tonic/tests/extern_path/uuid)

I found an example for Rust gRPC with TLS but it failed with the following error. Has anyone encountered this and how can it be resolved. I would think Rust is mature enough to support TLS

Error: tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 22, kind: InvalidInput, message: "Invalid argument" })))
~/samples/rust/tls/rust-grpc-demo/target/debug:

The project where I found the example is -

This started as an exercise to prove gRPC clients in different languages can talk successfully to a spring boot micro service. Apparently this does not work. I have three clients using identical protobuf definitions, The java client works fine.
The Rust client was plagued by getting the scoping right and character case problems. Once I got past these issued by empirical trial and error, I get
Error: Status { code: Unimplemented, message: "Method not found: imserver.imserver/hello", metadata: MetadataMap { headers: {"content-type": "application/grpc"} }, source: None }
The method definitely exists or else the java client wouldn't work. I expected another Rust issue but the Golang client fails for the same reason.
So the conclusion is that gRPC client and server will only work using the same language.

Update - The current rule is all languages should use the same version of protobuf. Have yet to prove this as versioning seems a mess.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.