-
Notifications
You must be signed in to change notification settings - Fork 391
[FR] - Firebase Admin Lite #2572
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
Comments
I found a few problems with this issue:
|
@jdgamble555 Thank you for raising this issue. Could you elaborate on the use case where the |
Yes, this will not solve the problem as "Edge" computing cannot load packages like "fs", "stream", "child_process", "crypto", "os", etc... This are usually items that are required with grpc, protobuf protocol etc... but NOT with REST API. J |
setting |
Ok I think I see what you're saying. Could you mention which Firebase products specifically would be useful to you in a "lite" SDK? You mentioned Firestore for one. Also, would you prefer a "tree-shakeable" API (like https://github.com/firebase/firebase-js-sdk) or an object-oriented API (like https://github.com/firebase/firebase-admin-node)? In any case, this is a pretty big undertaking so I have no promises as to if, or when, such a product will become available. But it's helpful to gather yours (and others') requirements for a time when we decide to scope such a project. |
Also, could you describe how you would envision authentication to work? Authentication in the firebase-node-admin SDK in non-google edge computing environments would likely need an "exported service account key file" (https://firebase.google.com/docs/admin/setup) and these environments often do not have access to the file system. Would it work, for example, to be able to specify the JSON contents of the key file rather than a path to the key file? Then, at runtime, the code would need to first obtain the key file from some other place (e.g. d1/kv/r2 in cloudflare workers) and specify it to the initialization function for Firebase. |
Here is how I setup my Firebase Admin app now. I use the environment variables. Firestore already has a "lite" version that works with the REST API. It will work on non-node runtimes. However, it is only Firestore (not Firebase Auth etc) so you can't use an authentication token nor fetch data behind Firestore Rules. Here is an example of a package that tries to mimic what Firebase Admin should already do. https://github.com/Moe03/firebase-admin-rest I have seen enough of these packages built over the years, that they never keep up-to-date. This is how it should work out-of-the-box IMO. Imagine: import { getAuth } from 'firebase-admin/auth/lite';
import { getFirestore } from 'firebase-admin/firestore/lite'; Similar to how the frontend works. J |
@jdgamble555 Thank you for the explanation and the example from @Moe03. I've logged b/343978422 internally to track this feature request and will keep you apprised of developments. But TBH it's unlikely that this feature request will see much progress without more requests from the community. For anyone who would like to see this feature, please reply with a brief explanation of your use case to help us prioritize this! |
Wow this is still an ongoing issue? (i got the notification from the previous one with GRPC slow init) iirc last time i used the admin sdk, preferRest was firebase/firestore only, so making one call to do an admin function meant the request took about 8 seconds in cloud functions/aws lambda. If your doing firebase auth with a backend like php (no firebase sdk), then you could be using a node based admin app to handle this, and loading the admin sdk was just always slow. 8 seconds for a user is just ridiculous, and the early solutions such as 'function keep alive / warmers' are really not dev friendly... 'oh hey our sdk is massive and takes a while to load, so spend more money with us keeping your code cached and it'll be fast'. Sorry if i come across annoyed by this, but I had many issues with firebase over the years from bad/missing/stale docs, to issues like this just taking forever to get fixed. |
hoping new firebase admin lite works on edge ^guessing its a firebase dependency? |
how to use it with Bun? |
Note that this repository specifically targets node (the name is |
@dconeybe - To be fair, it was built for Node before other Runtimes were popular and probably named to differentiate between go, python etc. It would be advantageous to build a "lite" version, just like J |
@jdgamble555 Thank you for your input. I don't disagree that there is value in providing a version that is decoupled from node.js. It's just a matter of prioritization. |
I'm desperate for a lightweight version of the Firebase Admin SDK. There have been numerous complaints about the painfully slow cold start caused by the Admin SDK dating back to 2020. |
Another vote for this.. we would like to use Firestore in a Vercel edge function, and as previously stated, the Vercel edge runtime is missing many packages required by Firebase Admin. |
Another vote for this. We would like to have some functions at edge that depend on Firebase admin SDK. |
+1 Edge functions offer really compelling benefits for certain applications, and are becoming increasingly popular as a result. The lack of an official SDK for Firestore in these environments is a big problem. |
Here to +1 this. Our team has lost so much time dealing with the REST interface 'manually' as it is not exactly developer friendly ;) |
+1 |
1 similar comment
+1 |
+1 |
+1 I need to connect Firebase Admin (Auth and Firestore) to my Cloudflare Functions, which serve as my API. I was very surprised to learn that Firebase Admin isn’t compatible with Edge Functions. This limitation has led me to explore other solutions. |
@dconeybe There are a lot of people requesting this feature. Can you please share if the team has any plan for it? |
I cannot make any concrete statements regarding if, or when, a "lite" SDK will be released. But I can say that it is on our radar and is being evaluated against competing priorities. |
Any update on this guys? |
Unfortunately, no updates at this point. |
We're 6 years in to the issue on slow starts, this obviously isn't getting done any time soon 🤦 |
I'm shocked that Firebase admin node doesn't support serverless even though they are widely used and have been around for years |
It runs fine in regular cloud functions, or on AWS Lambda etc, but the cold start time of the admin SDK is still awful. You can't rely on it as part of any custom signup or login flow. |
@ganey by "cold start time of the admin SDK" do you mean the Firestore API? If that's the case, do you still experience longer cold starts with the |
Yeah firestore is better with preferRest, has been since it was implemented as the GRPC is slow to setup. The admin SDK causes a slow down on fresh serverless functions |
Not only does it have a slow cold start on AWS Lambda, but it’s also completely broken on Vercel and Cloudflare. |
Is your feature request related to a problem? Please describe.
Currently Firebase cannot run on Deno, Cloudflare, Vercel Edge, or Bun (among others). Firebase will mainly be used in Node Serverless environments with Cold Starts, which are unacceptable for many app developers.
Describe the solution you'd like
If you don't require Authentication, you can use the "Firestore Lite" package. However, we cannot use Authentication or the Server Functions in order to keep our session. This is a HUGE problem and limits where Firebase can be deployed.
Describe alternatives you've considered
Using the REST API. However, it is EXTREMELY cumbersome in order to convert JSON data to the data types that REST API uses, as well as the problems handling tokens etc.
Additional context
It would be nice to be able to use the FirebaseServerApp as well, but this would not have ALL the features we may need in other JS environments.
J
The text was updated successfully, but these errors were encountered: