Unable to use Google Well Known Types with @grpc/reflection and @grpc/proto-loader
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
### Problem description
When using @grpc/proto-loader to load a .proto file that imports Google Well-Known Types (for example, google/protobuf/struct.proto), the server reflection fails to recognize those types at runtime.
Although proto-loader correctly builds and adds the Google WKTs to the packageDefinition object, running grpcurl with service reflection enabled produces the following error:
cannot resolve type: "*.google.protobuf.Duration" not found
A similar issue has been discussed here: https://github.com/fullstorydev/grpcurl/issues/459
### Reproduction Steps
Proto:
```
syntax = "proto3";
package multiply_function;
import "google/protobuf/duration.proto";
message Request {
int32 op1 = 1;
int32 op2 = 2;
}
message Response {
int32 prod = 1;
google.protobuf.Duration processing_time = 3; // How long the calculation took
}
service Multiply {
rpc multiply (Request) returns (Response);
}
```
```
// Load a .proto file that imports a Google well-known type
const packageDefinition = await load(protoFile);
// Create and register the ReflectionService
const reflectionService = new ReflectionService(packageDefinition);
reflectionService.addToServer(grpcServer);
```
### Environment
Node.js: v22.14.0
Dependencies:
@grpc/grpc-js: 1.13.3
@grpc/proto-loader: 0.7.15
@grpc/reflection: 1.0.4
### Additional context
I’ve also tried supplying complete file descriptors—including the Google WKTs, but the issue persists. Any help would be greatly appreciated!
Contributor guide
Assessment
This issue has not been assessed yet.