protobuf.js version: 6.6.3
Hey it's me again 😉
I've just attempted an upgrade from v4 to v6. With v4 I was generating js files like so:
pbjs ./proto/bcl.proto ./proto/MonitoringClientMessage.proto ./proto/MonitoringServerMessage.proto --target commonjs > ./proto/proto.js
With v6 I'm doing it like so: (I've also attempted with commonjs as well)
pbjs --target static-module --wrap es6 --out ./proto/proto6.js ./proto/bcl.proto ./proto/MonitoringClientMessage.proto ./proto/MonitoringServerMessage.proto
pbts --out ./proto/proto6.d.ts ./proto/proto6.js'
However, decoding always fails for me. Specifically, when I debug Reader.prototype.uint32 always produces 0:
/**
* Reads a varint as an unsigned 32 bit value.
* @function
* @returns {number} Value read
*/
Reader.prototype.uint32 = (function read_uint32_setup() {
var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)
return function read_uint32() {
value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;
value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;
value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;
value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;
value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;
/* istanbul ignore next */
if ((this.pos += 5) > this.len) {
this.pos = this.len;
throw indexOutOfRange(this, 10);
}
return value;
};
})();
It's rather strange and so I wanted to report in case I'm doing anything dozy... If there's any ideas I'd greatly appreciate them!
protobuf.js version:
6.6.3Hey it's me again 😉
I've just attempted an upgrade from v4 to v6. With v4 I was generating js files like so:
With v6 I'm doing it like so: (I've also attempted with commonjs as well)
However, decoding always fails for me. Specifically, when I debug
Reader.prototype.uint32always produces 0:It's rather strange and so I wanted to report in case I'm doing anything dozy... If there's any ideas I'd greatly appreciate them!