Firestore Bytes serializing not working on admin SDK[Firestore]
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- node.js, typescript
- 领域
- database
调研方向
从提供的 Node.js 复现开始,使用 Firebase SDK 13.1、Node.js 20.11 和 Admin SDK,重点关注 Firestore 文档序列化边界。未指定 repository 文件或测试;完成的标准是确定 Bytes/Uint8Array 表示是否可以一致地存储,并使用回归测试覆盖已确认的行为。
由索引模型根据 Issue 内容生成。
描述
- 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
});
- 主要语言
- TypeScript
- 星标
- 1.7k
- 派生
- 419
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 16
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-admin-node 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 条评论 · 已指派 1 人 ·
-
api: messaging
难度 3/5 1-2 天 新手友好度 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
难度 5/5 一周以上 新手友好度 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 条评论 · 已指派 1 人 ·
查看 firebase/firebase-admin-node 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/claude-code#96687 ·
-
good first issue
难度 1/5 1 小时以内 新手友好度 95/100
AOSSIE-Org/DebateAI#582 · 2 条评论 ·