ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

Using encode method on browser and node gives diff outputs for same data.

Open ajayjaggi97 opened this issue 3 years ago • 3 comments

Screenshot 2021-12-13 at 4 25 01 PM

Additional 1*1 on browser but not on node.

ajayjaggi97 avatar Dec 13 '21 10:12 ajayjaggi97

@stephenh when we are using Example.encode(data).finish() on the browser or inside our library there is some extra encoding as compared to when we ran the same function inside a react component or on server. We are not able to find the root cause of the issue.

ajayjaggi97 avatar Dec 14 '21 10:12 ajayjaggi97

@ajayjaggi97 hrm, yeah, I don't have any ideas; in theory the ts-proto code is exactly the same in both, so it'd probably be differences in the underlying protobuf-js/minimal code that ts-proto calls...

stephenh avatar Dec 15 '21 21:12 stephenh

This does not explain the different data, but there is a Buffer vs. Uint8Array issue in the underlying encoder (https://github.com/stephenh/ts-proto/issues/425).

Can you add more info? Like the code you call to get there, the data you put in, the hex output of the binary to copy into some proto debugger tool.

webmaster128 avatar Jan 11 '22 07:01 webmaster128