Can't compile and produce the js file for proto with inner "["
Hi! I have error with compiling .proto having inner "[" char when use custom mountebank:
`error: [2021-11-11T11:36:31.231Z] - [grpc:4542] /app/node_modules/@ozonru/mountebank-grpc/src/mock.js:40 throw new ProtoError(serviceOptions.file, error.message) ^
ProtoError: Could not loading a proto file "my_service.proto". Have you added a path with vendor's proto files to request?
Error message: illegal value '[' (protos/my_service/my_service.proto, line 440)
at /app/node_modules/@ozonru/mountebank-grpc/src/mock.js:40:19
at Array.forEach (
In proto on line 440 file we have field:
int64 some_id = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {required: ['some_id']}];
I assume it may be related to this.
Could you help to solve this problem?
most likely error in method loadSync
Running into this too
The @grpc/proto-loader library just calls out to protobufjs to parse .proto files. You should file an issue there about this error.
@murgatroid99 protobufjs fixed problem with '[' but it was in version after 5.0.3. Is it possible to update protobufjs version to latest (6.11.2)?
Fortunately, @grpc/proto-loader depends on protobufjs version ^6.10.0, so it should install the latest version.
Though, if the protobufjs issue you linked in the initial issue post is the cause of this issue, then it's actually an open bug that hasn't been fixed yet, which would explain why @grpc/proto-loader has not picked up a fix yet.
This is resolved on the master branch in protobufjs but not yet released. You can pin (or use a resolution) the protobufjs package to commit d13d5d5688052e366aa2e9169f50dfca376b32cf in the meantime to work around it.
I'm going to open up an issue in protobufjs to try and get a new release cut (https://github.com/protobufjs/protobuf.js/issues/1711).