Repository navigation
Is there a reason there is no loadBundle function in the admin-sdk? #2537
|
I have used the bundle creator extension to create a bundle of several queries. Previously I was running these queries server-side using the admin sdk. Is it a good idea to instead load the bundle server side? I don't see any bundle helper functions. It seems like I could just fetch the bundle, then use something like the unofficial "firebase-parser" to extract the data. But are there any better ways to do this, or is there a reason you would only want to access bundles using the client SDK? |
Replies: 1 comment
|
There's no bundle helper in the Admin SDK by design. Bundles exist to give client SDKs a local, cached copy of query results (server-timestamped, delta-able) so clients skip round trips. A server using the Admin SDK doesn't need that indirection — it can run the same query directly and get authoritative results. So the supported pattern with the bundle-builder extension: build the bundle server-side, host it (CDN, Storage, an HTTP function), and let web/mobile clients loadBundle() it. Parsing the bundle server-side with an unofficial parser is fragile — the format packs Firestore document protos plus metadata that only the client SDKs know how to materialize into a local query cache. If your motivation was "the query results are already computed in the bundle, why re-query" — the SDK query is the cheaper path: Firestore serves it from the same indexes, and you skip hosting + cache-invalidation logic entirely. |
There's no bundle helper in the Admin SDK by design. Bundles exist to give client SDKs a local, cached copy of query results (server-timestamped, delta-able) so clients skip round trips. A server using the Admin SDK doesn't need that indirection — it can run the same query directly and get authoritative results.
So the supported pattern with the bundle-builder extension: build the bundle server-side, host it (CDN, Storage, an HTTP function), and let web/mobile clients loadBundle() it. Parsing the bundle server-side with an unofficial parser is fragile — the format packs Firestore document protos plus metadata that only the client SDKs know how to materialize into a local query cache.
If y…