firebase / firebase/firebase-admin-node

Firestore Bytes serializing not working on admin SDK[Firestore]

Đang mở
#2,476 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
api: firestore
Ngôn ngữ chính
TypeScript
Star
1.7k
Fork
419
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
16

Mô tả

* Operating System version:w10
* Firebase SDK version: 13.1
* Firebase Product: Firestore
* Node.js version: 20.11
* NPM version: 10.3

When trying to store uint8array as Firestore.Bytes from admin-sdk throw a serializing error:

`Error: Value for argument "data" is not a valid Firestore document. Couldn't serialize object of type "Bytes" (found in field "binaryData"). Firestore doesn't support JavaScript objects with custom prototypes (i.e. objects that were created via the "new" operator).`

Uint8array seems to be the way to go, but then mismatch Web SDK (web sdk return bytes array as Firestore.Bytes objects).

#### Steps to reproduce:

```
import { Bytes } from "firebase/firestore";

const bin = new Uint8Array([0x48, 0x65, 0x6C, 0x6C, 0x6F]);

const fsBytes = Bytes.fromUint8Array(bin);

db.collection('your_collection').doc('your_document').set({
binaryData: fsBytes
});
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.