Skip to content

Protobuf.js cannot parse fields with message values inside of custom field option messages #1428

@murgatroid99

Description

@murgatroid99

protobuf.js version: 6.9.0

Protobuf.js fails to parse this .proto file, throwing this error:

Error: illegal name '}' (deps/envoy-api/envoy/api/v2/core/http_uri.proto, line 53)
    at illegal (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:94:16)
    at parseOptionValue (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:561:27)
    at parseOptionValue (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:564:21)
    at parseOption (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:553:9)
    at parseInlineOptions (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:587:17)
    at parseField_line (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:378:13)
    at ifBlock (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:292:17)
    at parseField (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:368:9)
    at parseType_block (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:340:21)
    at ifBlock (/mnt/d/Documents/grpc-node/packages/grpc-js/node_modules/protobufjs/src/parse.js:288:17)

referring to this field of the message:

  google.protobuf.Duration timeout = 3 [(validate.rules).duration = {
    required: true
    gte {} // This is the line the error refers to
  }];

The protoc tool parses this file just fine, so this is a valid protobuf definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions