protobuf.js version: 6.6.5
When passing in a ByteBuffer instead of a Uint8Array, decode fails silently and return an "empty" message. Calling toObject on the message will return an empty object. The expected is to validate the input parameters and throw an exception if it's of an invalid type.
try {
const pbNotifications = pbRoot.lookup('Notifications');
const data = new ByteBuffer(...);
const notification = pbNotifications.Notification.decode(data).toObject();
} catch (error) {
logger(error);
}
As a side note. I came across this bug after switching from v5 to v6. A part of the code, where the test coverage was not ideal, was failing silently. It was only discovered at functional QA time.
protobuf.js version: 6.6.5
When passing in a
ByteBufferinstead of aUint8Array, decode fails silently and return an "empty"message. CallingtoObjecton the message will return an empty object. The expected is to validate the input parameters and throw an exception if it's of an invalid type.As a side note. I came across this bug after switching from v5 to v6. A part of the code, where the test coverage was not ideal, was failing silently. It was only discovered at functional QA time.