Skip to content

Commit 2f58b4f

Browse files
committed
Fix internal assertion encountered when testing with jsdom.
1 parent b64b947 commit 2f58b4f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/firestore/src/remote/serializer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export function toBytes(
252252
*/
253253
export function fromBytes(
254254
serializer: JsonProtoSerializer,
255-
value: string | Uint8Array | undefined
255+
value: string | Uint8Array | Buffer | undefined
256256
): ByteString {
257257
if (serializer.useProto3Json) {
258258
hardAssert(
@@ -262,8 +262,10 @@ export function fromBytes(
262262
return ByteString.fromBase64String(value ? value : '');
263263
} else {
264264
hardAssert(
265-
value === undefined || value instanceof Uint8Array,
266-
'value must be undefined or Uint8Array'
265+
value === undefined ||
266+
value instanceof Buffer ||
267+
value instanceof Uint8Array,
268+
'value must be undefined, Buffer, or Uint8Array'
267269
);
268270
return ByteString.fromUint8Array(value ? value : new Uint8Array());
269271
}

0 commit comments

Comments
 (0)