grpc ruby error: `block in marshal_proc': undefined method `encode' for String:Class (NoMethodError)

90 views
Skip to first unread message

Bo Tian

unread,
Sep 15, 2021, 9:42:50 PM9/15/21
to grpc.io
Hi All,

I got an error of : `block in marshal_proc': undefined method `encode' for String:Class (NoMethodError) when sending protobuf message to server.  I wonder if someone can help me on this.

actually there is an encode method in generated service ruby file. here is the snippet

class Service
       include GRPC::GenericService
       self.marshal_class_method = :encode
       self.unmarshal_class_method = :decode
       self.service_name = 'opentelemetry.proto.collector.metrics.v1.MetricsService'
       # For performance reasons, it is recommended to keep this RPC
       # alive for the entire life of the application.
       rpc :Export, ::ExportServiceRequest, ::ExportServiceResponse
      end
      Stub = Service.rpc_stub_class

Here is the call stack:

6: from ./metrics.rb:87:in `main'
5: from /Users/bo/.rvm/gems/ruby-2.6.6/gems/grpc-1.40.0-universal-darwin/src/ruby/lib/grpc/generic/service.rb:171:in `block (3 levels) in rpc_stub_class'
4: from /Users/bo/.rvm/gems/ruby-2.6.6/gems/grpc-1.40.0-universal-darwin/src/ruby/lib/grpc/generic/client_stub.rb:179:in `request_response'
3: from /Users/bo/.rvm/gems/ruby-2.6.6/gems/grpc-1.40.0-universal-darwin/src/ruby/lib/grpc/generic/interceptors.rb:170:in `intercept!'
2: from /Users/bo/.rvm/gems/ruby-2.6.6/gems/grpc-1.40.0-universal-darwin/src/ruby/lib/grpc/generic/client_stub.rb:180:in `block in request_response'
1: from /Users/bo/.rvm/gems/ruby-2.6.6/gems/grpc-1.40.0-universal-darwin/src/ruby/lib/grpc/generic/active_call.rb:352:in `request_response'
/Users/bo.tian/.rvm/gems/ruby-2.6.6/gems/grpc-1.40.0-universal-darwin/src/ruby/lib/grpc/generic/rpc_desc.rb:35:in `block in marshal_proc': undefined method `encode' for String:Class (NoMethodError)

Thanks,
Bo

Reply all
Reply to author
Forward
0 new messages