-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Bun and firestore (firebase-admin) #8549
Comments
Was about to post the same issue, but @acoyfellow did it 2 hours before. Amazing :D Ran into the same issue. The same script runs OK with After a while I get:
|
It looks like we now get the response data into the http2 stream, but there seems to be a bug into |
Any update on this? Still having problems in 1.0.29 |
Any update here? It makes it unusable for a lot of projects with this piece broken :-) |
FWIW we are just now successfully using bun to run firestore rules testing against the emulator with @firebase/rules-unit-testing. Very few issues (and we got to remove a bunch of workarounds that were needed for node/jest), relatively painless transition. |
I have a similar problem but I get an error message. Using the same code in node.js without bun works without a problem. The document exists. When I try to get the whole collection, it only returns part of it.
Error: |
Hey this is still persistent for me on bun v: 1.1.3 running on windows 10 To reproduce: $ bun add firebase-admin then create a demo firebase project, create a firesotre database then create a collection named "users", add any sample doc, and paste the service account config then run the script. const admin = require("firebase-admin");
export const GLOBAL_SERVICE_ACCOUNT = {
projectId: "____",
privateKey:
"____",
clientEmail: "___",
};
const app = admin.initializeApp({
credential: admin.credential.cert(GLOBAL_SERVICE_ACCOUNT), // replace with your service account
});
export const db = app.firestore();
async function testFirestore() {
console.log('connecting..')
const userRef = await db.collection(`users`).limit(1).get();
console.log(userRef.docs[0].data());
}
testFirestore() Result successful for ts-node: ts-node --transpileOnly bun-firebase.ts
connecting..
{
photoURL: 'https://lh3.googleu****',
uid: '********',
displayName: 'Tedr****',
joinedAt: 1707503064,
location: '(d****',
referredFrom: '',
widgets: [],
email: '*****',
freeLTsTS: *****,
loadTokens: *****
} Result always undefined in bun $ bun run bun-firebase.ts
connecting..
14 | export const db = app.firestore();
15 |
16 | async function testFirestore() {
17 | console.log('connecting..')
18 | const userRef = await db.collection(`users`).limit(1).get();
19 | console.log(userRef.docs[0].data());
^
TypeError: undefined is not an object (evaluating 'userRef.docs[0].data')
at C:\Users\Mohamed\Desktop\github_repos\custom-vf-nextjs\vg-docker\bun_index.ts:19:17 |
Unfortunately, this is the only thing that prevents me from migrating to bun in all my backend projects. 🥲 |
Just published firebase-admin-rest: Tiny Typesafe Firebase Admin REST API wrapper that works on Vercel Edge functions, Bun, Cloudflare workers, Deno or any JS runtime. Have already been dealing with the same problems for ages now (Bun, workers), it was crucial we use workers tho so I had to use the firebase rest api, and it wasn't fun, that package might help someone out tho :) // firebase-admin
const db = app.firestore();
const docs = await db.collection(`users`).limit(10).get()
// firebase-admin-rest
const db = await initFirebaseRest().firestore();
const docRef = await db.doc<User>(`users`).limit(10).page(2).get(); // pagination too! |
this is great, thanks for the effort @Moe03. Will definitely explore using this for some projects. |
Confirmed. Do something about it! I want |
Are there any updates on this? I've been using the "firebase-admin-rest" by Moe03, but would be awesome to be able to use the official firebase package for stability sake. |
+1 this isn't supposed to do all the functionalities of the official sdk of course and is just a temporary solution I had to create |
+1 need this too, not sure what we can do in our monorepo with one repo of firebase functions |
would be good to have firebase working with bun, atm we cant use bun because we don't have access to firebase auth and storage buckets :( |
+1 gonna drop back to node for the time being... |
What version of Bun is running?
1.0.23
What platform is your computer?
Linux 5.15.0-91-generic x86_64 x86_64
What steps can reproduce the bug?
What is the expected behavior?
I expect to be able to use npm package
firebase-admin
, specifically firestoreWhat do you see instead?
No errors, just hangs.
Additional information
No response
The text was updated successfully, but these errors were encountered: