You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm upgrading from 6.11.3 to 7.0.0. I have a test that calls
/** * Take the provided information and encode it into our EDEK protobuf structure. */exportconstencodeEdeks=(segmentId: number,documentId: string,userKeys: EncryptedAccessKey[],groupKeys: EncryptedAccessKey[]): Uint8Array=>{constuserDeks=userKeys.map(convertEncryptedAccessKey("userId"));constgroupDeks=groupKeys.map(convertEncryptedAccessKey("groupId"));// TODO: types say this should return a Uint8Array but it's actually returning a Buffer. Nothing in the changlog// indicates this should be happening going from 6.11.3 to 7.0.0, but testing indicates it is.constx=PBEDeks.encode(newPBEDeks({edeks: [...groupDeks, ...userDeks], segmentId, documentId})).finish();console.log(x);returnx;};
and expects any<Uint8Array> back. That test is failing after upgrading because it's now getting a Buffer back. I believe this is an un-communicated breaking change due to the buffer configuration support (add support for buffer configuration (#1372) (101aa1a)). In my case the code keeps working in the browser (where I don't have Buffer polyfilled) but fails in Jest tests (which do have a Buffer lying around). There could be other non-test situations where this would break people's current code.
The reader-writer example run in an environment where Buffer is available but not expected/desired would reproduce the issue.
Desired outcome for me would be either:
document the possibly breaking change in the "Breaking Changes" list for 7.0.0 or,
make Writer explicitly just Uint8Array and those wanting to use Buffer use BufferWriter with a create that also explicitly uses/expects Buffer. If someone wants the implicit behavior they could create their own FlexibleWriter (or it could be provided) that has the ternary on util.Buffer in the create to make one of the two explicit ones.
The text was updated successfully, but these errors were encountered:
Confirmed that guarding against it in my tests works. So the workaround is easy, but it'll likely be hard for people upgrading to detect that this is the issue (especially if it's not called out as potentially breaking).
protobuf.js version: 7.0.0
I'm upgrading from 6.11.3 to 7.0.0. I have a test that calls
and expects
any<Uint8Array>
back. That test is failing after upgrading because it's now getting aBuffer
back. I believe this is an un-communicated breaking change due to the buffer configuration support (add support for buffer configuration (#1372) (101aa1a)). In my case the code keeps working in the browser (where I don't have Buffer polyfilled) but fails in Jest tests (which do have a Buffer lying around). There could be other non-test situations where this would break people's current code.The reader-writer example run in an environment where Buffer is available but not expected/desired would reproduce the issue.
Desired outcome for me would be either:
Writer
explicitly justUint8Array
and those wanting to useBuffer
useBufferWriter
with acreate
that also explicitly uses/expectsBuffer
. If someone wants the implicit behavior they could create their ownFlexibleWriter
(or it could be provided) that has the ternary onutil.Buffer
in thecreate
to make one of the two explicit ones.The text was updated successfully, but these errors were encountered: