@grpc/proto-loader: issue when importing proto files if file directory is `google/protobuf/<file>`
See original GitHub issueI use a set of protobuf interfaces defined by Google such as google.protobuf.Struct. I have these files under the directory google/protobuf/
.
Since I moved to @grpc/proto-loader I started having issues using message structures from these files in other protobuf interfaces. The content from fields using messages from these files is always empty. After several tests I discovered that this does not happen if the path is not google/protobuf
. If I change it to google_1/protobuf
or google/protobuf_1
it works!
I was not experiencing this issue when loading protos the “old way” - grpc.load({ protoRoot, filePath})
. Could this be some reserved keyword conflict while loading the files?
My grpc loader options:
const packageDef = protoLoader.loadSync(filepath, {
arrays:false,
defaults: false,
keepCase: true,
includeDirs: [protoRoot]
});
The protos are defined here.
grpc
version: 1.11.3
@grpc/proto-loader
version: 0.1.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
You are correct. The only reason
@grpc/proto-loader
exists is for exactly the kind of situation you see yourself in right now. If you’ve determined that the issue is in fact in protobufjs, and opening an issue there, I will then close these two here.For cross-reference, you have opened issue https://github.com/dcodeIO/protobuf.js/issues/1042.
Tested locally with plain
protobuf.js
and same problem occurs. I will post an issue there.