Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile and produce the js file for proto with inner "[" #1964

Open
ievseev opened this issue Nov 11, 2021 · 6 comments
Open

Can't compile and produce the js file for proto with inner "[" #1964

ievseev opened this issue Nov 11, 2021 · 6 comments

Comments

@ievseev
Copy link

ievseev commented Nov 11, 2021

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 ()
at Object.getServerInstance (/app/node_modules/@ozonru/mountebank-grpc/src/mock.js:31:37)
at Server. (/app/node_modules/@ozonru/mountebank-grpc/src/index.js:22:41)
at Object.onceWrapper (events.js:420:28)
at Server.emit (events.js:314:20)
at emitCloseNT (net.js:1657:8)
at processTicksAndRejections (internal/process/task_queues.js:83:21)`

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?

@ievseev
Copy link
Author

ievseev commented Nov 11, 2021

most likely error in method loadSync

@pytlesk4
Copy link

Running into this too

@murgatroid99
Copy link
Member

The @grpc/proto-loader library just calls out to protobufjs to parse .proto files. You should file an issue there about this error.

@ievseev
Copy link
Author

ievseev commented Nov 15, 2021

@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)?

@murgatroid99
Copy link
Member

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.

@Drew-Kimberly
Copy link

Drew-Kimberly commented Apr 25, 2022

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 (protobufjs/protobuf.js#1711).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants