Search code examples
protocol-buffersgoogle-cloud-endpointsgrpcgoogle-cloud-endpoints-v2

gcloud endpoints deploy error unresolved type


I'm trying to deploy a service which requires google protobuf's Timestamp but I am receiving an error.

gcloud endpoints services deploy api_descriptor.pb api_config.yaml --validate-only

ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT: Cannot 
convert to service config.
'ERROR: unknown location: Unresolved type '.google.protobuf.Timestamp''

my command to generate api_descriptor.pb:

protoc \
--plugin=protoc-gen-go=${GOBIN}/protoc-gen-go \
-I . proto/service.proto \
--descriptor_set_out=api_descriptor.pb \
--go_out=plugins=grpc:. \

relevant bit from proto file which requires google.protobuf.Timestamp:

syntax = "proto3";

package proto;

import "vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto";

message CandleStick {
    string ID = 1;
    double Open = 2;
    double Close = 3;
    double High = 4;
    double Low = 5;

    google.protobuf.Timestamp TimeStamp = 6;
}

Tried for hours unsuccessfully to resolve this issue. Thanks in advance!


Solution

  • In your protoc command line invocation, I think you need to include all the imports in the generated descriptor. You can do this using --include_imports:

    protoc \
    --plugin=protoc-gen-go=${GOBIN}/protoc-gen-go \
    --include_imports \
    -I . proto/service.proto \
    --descriptor_set_out=api_descriptor.pb \
    --go_out=plugins=grpc:. \