Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Admin version of the Firestore Lite SDK #1879

Closed
GriffinJohnston opened this issue Aug 18, 2022 · 16 comments · Fixed by #1901
Closed

[FR] Admin version of the Firestore Lite SDK #1879

GriffinJohnston opened this issue Aug 18, 2022 · 16 comments · Fixed by #1901

Comments

@GriffinJohnston
Copy link

GriffinJohnston commented Aug 18, 2022

The problem
There is a longstanding issue with extremely slow cold-start times when using the official Nodejs Firestore library in serverless environments: https://issuetracker.google.com/issues/158014637. It appears that the underlying issue is very difficult to address (hence the unresolved years-old P1/S1 issue), and a proper interim fix is long overdue.

One solution is to use the Firestore REST API directly. This dramatically improves cold start times, but at the cost of a seriously degraded developer experience. There has been at least one attempt by a Firestore user to create an unofficial wrapper library (https://github.com/bountyrush/nodejs-firestore). This library works, but is maintained by a single developer, and is not a replacement for an official library for obvious reasons.

The solution
A lightweight wrapper library that adds a friendly interface to the Firestore REST API for simple CRUD operations would do a lot to ameliorate the three year old cold start bug. Essentially a Nodejs equivalent of the Firestore Lite SDK. A Google employee has suggested that this library might even be able to share significant code with Firestore Lite: https://issuetracker.google.com/issues/158014637#comment183

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@bsplosion
Copy link

As a note, this issue does not just affect cloud functions, but rather affects anything that needs to be cold-started. Reproduction samples work the same way on Docker containers hosted virtually anywhere, or when rebuilding an application during a live reload - the library itself appears to be the culprit, not the hosting environment.

@willbattel
Copy link

This would definitely help a lot of developers, however in our case we use a lot of transactions which seem to potentially be beyond the scope of a "lite" SDK. If we could get, either in addition to or instead of this, an official Google-maintained equivalent of https://github.com/bountyrush/nodejs-firestore it could help with that case. We really just want the speed of REST with the DX of the Admin SDK.

@rodneyrd
Copy link

Thanks for creating the issue, indeed it would definitely help a lot of us !

@ganey
Copy link

ganey commented Aug 18, 2022

I'm also interested in this, parsing an access token and calling firestore in a single request can take ages when cold on AWS lambda

@nth-child
Copy link

Much needed. Thank you.

@manwithsteelnerves
Copy link

I'm the developer for REST api implementation - https://github.com/bountyrush/nodejs-firestore

I thought of giving a try with lite web js sdk but the links are broken for source code. Can someone point at the right link?
https://cloud.google.com/firestore/docs/reference/libraries

@ganey
Copy link

ganey commented Aug 19, 2022

@jamesdaniels
Copy link
Member

This was posted to the public issue but repeating here for visibility.

@google-cloud/firestore has begun experimenting with a preferRest option (@6.1.0-pre.0). Folks should give that a spin. I'm sure once it lands we'll look at exposing that option in firebase-admin, as this library wraps @google-cloud/firestore.

@GriffinJohnston
Copy link
Author

I'm seeing a significant performance boost from this, which is very exciting. It will be even better if it ends up in firebase-admin, which will simplify usage and help prevent problems like this: googleapis/nodejs-firestore#760

@GriffinJohnston
Copy link
Author

GriffinJohnston commented Sep 15, 2022

@jamesdaniels now that preferRest is in google-cloud/firestore v6.2, can we get an update on exposing that option in firebase-admin? Should I open a new ticket for that, since this has evolved a bit?

@lahirumaramba
Copy link
Member

This feature is now available in firebase-admin v11.4.0. Thank you everyone for your patience!

@rodneyrd
Copy link

rodneyrd commented Dec 15, 2022 via email

@jdgamble555
Copy link

We need to reopen this again. Now that Edge Functions are popular, we need Firebase Admin Lite SDK to be allowed to handle session variables and fetch calls with the admin key on the server.

J

@dconeybe
Copy link

PSA: Please continue discussion on this topic at #2572

@Rizzist
Copy link

Rizzist commented Jun 5, 2024

+1

@alexander-fenster alexander-fenster removed their assignment Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.