Open ashubham opened 5 years ago
Greetings! Can you share the proto files you're using to get this?
Hi @JustinBeckwith
I came into same error, and I uploaded the proto file I use.
pbjs --sparse -p "$GOPATH/src/github.com/gogo/protobuf" -p . -t json test.proto
Proto Files: two-proto-files.zip
Thanks!
+1
I meet this again, it seems occurs when process extensions:
I import gogo/protobuf/gogo.proto
to optimize emitted code, then it throws the error, I found it throws when process the extensionField:
The minimum code to reproduce the error:
syntax = "proto3";
package stmp.examples.gomoku;
option go_package = "github.com/acrazing/stmp-go/examples/gomoku/gomoku_pb;pb";
import "github.com/envoyproxy/protoc-gen-validate/validate/validate.proto";
//import "stmp/stmp.proto";
// disable this for avoid pbjs throws error
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.description_all) = false;
option (gogoproto.goproto_unrecognized_all) = false;
option (gogoproto.goproto_extensions_map_all) = false;
option (gogoproto.goproto_unkeyed_all) = false;
option (gogoproto.goproto_sizecache_all) = false;
message Empty {
}
execute:
yarn pbjs -t static-module -w commonjs -p ./vendor -p . \
--no-create --no-verify \
--no-convert --no-delimited --keep-case --sparse \
-o ./examples/gomoku/gomoku_pb/gomoku.pb.js ./examples/gomoku/gomoku_pb/*.proto
Still happening with version 6.10.1
For me adding the following was enough to resolve the issue:
if (object.extensionField.parent !== null) {
object.extensionField.parent.remove(object.extensionField);
}
No idea if that's good enough to open a merge request with though.
protobuf.js version: 6.8.3
When using
--sparse
option in thepbjs
CLI command. It fails with an errorTypeError: Cannot read property 'remove' of null