-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Description
protobuf.js version: 5.0.3 and 6.8.8
A Go-written message has an empty string as a map value, but the Node version fails when deserializing it because it sees it as undefined.
The value for a Message on the Go side looks like this —
offset:69 key:"some-key" value:"some-vlaue" timestamp:1568177809419877000 subject:"test11" headers:<key:"reply" value:"" > headers:<key:"subject" value:"test11" >
Reproduction steps
docker run -p 4222:4222 -ti nats:latest --debug --tracein a window.go get github.com/liftbridge-io/go-liftbridgeand then$GOPATH/bin/liftbridge --raft-bootstrap-seed --nats-servers nats://localhost:4222 --level debugin another window.- Clone my repo from
https://github.com/paambaati/node-liftbridge.gitin yet another window. yarn installornpm installyarn run debugornpm run debug
When trying to read this message on the Node.js side, I get this error —
Error [AssertionError]: Assertion failed
at new goog.asserts.AssertionError (~/node-liftbridge/node_modules/google-protobuf/google-protobuf.js:1166:22)
at Object.goog.asserts.doAssertFailure_ (~/node-liftbridge/node_modules/google-protobuf/google-protobuf.js:1186:9)
at Object.goog.asserts.assert [as assert] (~/node-liftbridge/node_modules/google-protobuf/google-protobuf.js:1193:55)
at Function.jspb.Map.deserializeBinary (~/node-liftbridge/node_modules/google-protobuf/google-protobuf.js:3881:18)
at ~/node-liftbridge/grpc/generated/api_pb.js:2259:18
at jspb.BinaryReader.readMessage (~/node-liftbridge/node_modules/google-protobuf/google-protobuf.js:3517:5)
at Function.proto.proto.Message.deserializeBinaryFromReader (~/node-liftbridge/grpc/generated/api_pb.js:2258:14)
at Function.proto.proto.Message.deserializeBinary (~/node-liftbridge/grpc/generated/api_pb.js:2214:30)
at deserialize_proto_Message (~/node-liftbridge/grpc/generated/api_grpc_pb.js:59:25)
at ~/node-liftbridge/node_modules/grpc/src/common.js:38:12
at ~/node-liftbridge/node_modules/grpc/src/client_interceptors.js:689:22 {
message: 'Assertion failed',
reportErrorToServer: true,
messagePattern: 'Assertion failed'
}
Specifically, this happens when the header value for key "reply" is read. Printing the values f and g in the below snippet prints "reply" for f and undefined for g, when one would expect it to be "" (an empty string).
jspb.Map.deserializeBinary = function(a, b, c, d, e, f) {
for (var g = void 0; b.nextField() && !b.isEndGroup();) {
var h = b.getFieldNumber();
1 == h ? f = c.call(b) : 2 == h && (a.valueCtor_ ? (goog.asserts.assert(e), g = new a.valueCtor_, d.call(b, g, e)) : g = d.call(b))
}
goog.asserts.assert(void 0 != f);
goog.asserts.assert(void 0 != g);
a.set(f, g)
};
Related issues
GaloisGirl
Metadata
Metadata
Assignees
Labels
No labels