grpc_cli does not work if proto file contains google.protobuf.Timestamp

Created on 24 Mar 2017  路  3Comments  路  Source: grpc/grpc

(Vaguely related to https://github.com/golang/protobuf/issues/298)

I have a proto file like this for my gRPC definition:

 syntax = "proto3";
 import "google/protobuf/timestamp.proto";

and Service definitions which use google.protobuf.Timestamp type to store timestamps.

I am compiling my program to Go using grpc-go and trying to reflect on it using grpc_cli.

$ ./grpc_cli ls localhost:8001
UserDirectory
grpc.reflection.v1alpha.ServerReflection

This works but when I try to go into detail I get errors about google.protobuf.Timestamp

$ ./grpc_cli ls localhost:8001 UserDirectory -l
[libprotobuf ERROR google/protobuf/descriptor.cc:3422] Invalid proto descriptor for file "coffeelog.proto":
[libprotobuf ERROR google/protobuf/descriptor.cc:3425]   coffeelog.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
[libprotobuf ERROR google/protobuf/descriptor.cc:3425]   PostActivityRequest.Date: "google.protobuf.Timestamp" seems to be defined in "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto", which is not imported by "coffeelog.proto".  To use it here, please add the necessary import.
(and more...)

I am successfully able to get grpc_cli to do ls -l on the helloworld.GreeterServer sample program on grpc-go: https://github.com/grpc/grpc-go/blob/master/examples/helloworld/helloworld/helloworld.proto since it doesn't contain the google.protobuf.Timestamp.

aretools dispositioto close kinbug

Most helpful comment

Hey guys !

This is an old issue, but i just found a work arround.
Just get the same issue, but it seems that it's because i hadn't the correct package in my vendor folder.

For the story, I have a proto file which import "google/protobuf/timestamp.proto";
The generated stubs will import google_protobuf "github.com/golang/protobuf/ptypes/timestamp"

I got in my GOPATH the correct files : github.com/golang/protobuf/ptypes/timestamp
But reflectivity show error, Import .... not found. Just like this issue describe it.

govendor, show me that github.com/golang/protobuf/ptypes/timestamp was as external dependency.
So i just :

  • govendor add github.com/golang/protobuf/ptypes/timestamp
  • recompile my server
  • relaunch my server
    and after the reflectivity working well, everything is found and works.

I don't know why, it's maybe in the classloader name or resolver.

All 3 comments

@menghanl Looks like it's related to the grpc go reflection service. Could you please take a look?

any progress?

Hey guys !

This is an old issue, but i just found a work arround.
Just get the same issue, but it seems that it's because i hadn't the correct package in my vendor folder.

For the story, I have a proto file which import "google/protobuf/timestamp.proto";
The generated stubs will import google_protobuf "github.com/golang/protobuf/ptypes/timestamp"

I got in my GOPATH the correct files : github.com/golang/protobuf/ptypes/timestamp
But reflectivity show error, Import .... not found. Just like this issue describe it.

govendor, show me that github.com/golang/protobuf/ptypes/timestamp was as external dependency.
So i just :

  • govendor add github.com/golang/protobuf/ptypes/timestamp
  • recompile my server
  • relaunch my server
    and after the reflectivity working well, everything is found and works.

I don't know why, it's maybe in the classloader name or resolver.

Was this page helpful?
0 / 5 - 0 ratings