-
Notifications
You must be signed in to change notification settings - Fork 677
Open
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: fullstorydev/grpcurl#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!