Firestore Bytes serializing not working on admin SDK[Firestore]
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript
- Domain
- database
Research direction
Start with the supplied Node.js reproduction using Firebase SDK 13.1, Node.js 20.11, and the Admin SDK, focusing on the Firestore document serialization boundary. No repository file or test is named; done means establishing whether the Bytes/Uint8Array representations can be stored consistently and covering the confirmed behavior with a regression test.
Written by the indexing model from the issue text.
Description
- 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
});
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 419
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-node
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 comments · 1 assignee ·
-
api: messaging
Difficulty 3/5 1-2 days Newbie friendliness 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
Difficulty 5/5 Over a week Newbie friendliness 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 comment · 1 assignee ·
All issues in firebase/firebase-admin-node
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
AOSSIE-Org/DebateAI#582 · 2 comments ·