Giter Site home page Giter Site logo

grpc example not running about yarpc-go HOT 4 CLOSED

Choongkyu avatar Choongkyu commented on June 3, 2024
grpc example not running

from yarpc-go.

Comments (4)

peats-bond avatar peats-bond commented on June 3, 2024 1

Ah, so you've actually run into two interesting edge cases.

The first issue is that your Protobuf file is defining methods using camelCase instead of PascalCase (ie setFoo instead of SetFoo). This is causing YARPC's protoc plugin to generate private methods on the interface, which are unimplementable if generated into a separate package. At Uber, we don't run into this issue since we have linters than enforce methods to be PascalCase.

Next, internally some services use an Fx layer that enables the gRPC reflection protocol. Since you are not hooking up the reflection server manually, you'll need to use protoc and pass the FileDescriptorSet using -F (I do not recall if this works with yab-YAML files)

$ yab --help
...
-F, --file-descriptor-set-bin= A binary file containing a compiled protobuf FileDescriptorSet.

from yarpc-go.

Choongkyu avatar Choongkyu commented on June 3, 2024 1

thank you very much! Swapping to pascal case and adding that flag fixed both issues.

from yarpc-go.

peats-bond avatar peats-bond commented on June 3, 2024

Hey @zebralight, we do have gRPC examples that already exist here:

It's hard to tell what's happening without the full context of the generated code, but it seems like your Server does not implement the generated YARPC interface.

  • You have one private method, getValue which should be public: GetValue
  • You're missing the SetValue, the second method defined in your Protobuf file
  • Double check that the server implements exactly the interface generated by YARPC.

Please check out the examples and re-open if you have any questions!

from yarpc-go.

Choongkyu avatar Choongkyu commented on June 3, 2024

hi @AlexAPB. thank you for the response. I made the advised change of setting getValue to be public but am seeing the same error issued which was:

server/main.go:89:62: cannot use server (type *Server) as type keyvalue.KeyValueYARPCServer in argument to keyvalue.BuildKeyValueYARPCProcedures:
	*Server does not implement keyvalue.KeyValueYARPCServer (missing keyvalue.getValue method)
		have GetValue(context.Context, *keyvalue.GetValueRequest) (*keyvalue.GetValueResponse, error)
		want keyvalue.getValue(context.Context, *keyvalue.GetValueRequest) (*keyvalue.GetValueResponse, error)

. I've also added SetValue and didn't include it in the original ticket since the error was only alerting me about getValue.

I just tried out the protobuf example and tried running it and then calling it with this yab:

service: example
method: EchoIn
peer: grpc://127.0.0.1:34111
timeout: 1000ms
request:
  message: "foo"
  num_responses: 3

and am getting this response:

Failed while parsing input: rpc error: code = Unimplemented desc = unrecognized procedure "grpc.reflection.v1alpha.ServerReflection::ServerReflectionInfo" for service "example"

thanks again!

from yarpc-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.