fullstorydev / fullstorydev/grpcurl
Server reflection fails when using well-known types (Timestamp)
- Dominant language
- Go
- Stars
- 12.8k
- Forks
- 580
- Avg merge
- 1h 8m
- Merged PRs (30d)
- 5
Description
## Problem
Server reflection fails when using `google.protobuf.*` well-known types such as `Timestamp` or `Duration`, requiring them to be registered by the server as well for `grpcurl` to work properly.
## Setup
I am using `grpc-js` with NestJS integration along with `@grpc/reflection` to register all my `.proto` files on startup. It works exactly like [their example](https://github.com/nestjs/nest/blob/master/sample/04-grpc/src/grpc-client.options.ts). I also use [ts-proto](https://github.com/nestjs/nest/blob/master/sample/04-grpc/src/grpc-client.options.ts) for generating the TypeScript interfaces from my `.proto` files.
I can `grpcurl localhost:5051 list` to see my services as expect:
```
$ grpcurl -plaintext localhost:5051 list
core.Organizations
core.Users
```
However, once I try to list one that uses a `Timestamp` message I get the following error:
```
$ grpcurl -plaintext localhost:5051 list core.Organizations
Failed to list methods for service "core.Organizations": proto: message field "core.Organization.createdAt" cannot resolve type: "*.google.protobuf.Timestamp" not found
```
Interestingly, if I test it using the `-import-path` and `-proto` flags then it works fine!
```
$ grpcurl -plaintext -import-path ./proto -proto organizations.proto localhost:5051 describe core.Organizations
core.Organizations is a service:
service Organizations {
rpc GetOrganization ( .core.GetByIdRequest ) returns ( .core.Organization );
rpc GetOrganizationProfile ( .core.GetByIdRequest ) returns ( .core.OrganizationProfile );
}
$ grpcurl -plaintext -import-path ./proto -proto organizations.proto localhost:5051 describe core.Organization
core.Organization is a message:
message Organization {
string id = 1;
string displayName = 2;
optional string description = 3;
string type = 4;
string profileUsername = 5;
repeated .core.OrganizationProfileInfo profiles = 6;
.core.OrganizationContact contact = 7;
.core.OrganizationAddress address = 8;
optional string countryCode = 9;
optional string phoneNumber = 10;
optional string emailAddress = 11;
.google.protobuf.Timestamp createdAt = 12;
.google.protobuf.Timestamp updatedAt = 13;
}
```
I do not have any local copies of the Google well-known type `.protos` and my import looks like this in `organizations.proto`:
```
syntax = "proto3";
import "google/protobuf/timestamp.proto";
import "common.proto";
package core;
```
## Expectation
That `grpcurl` would have the Google well-known types pre-registered so that server reflection does not need to register them, which seems a bit redundant.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.