Open acoyfellow opened 5 months ago
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 node
. I have a simple script (similar to @acoyfellow's script) that hangs when trying to access the database (connection seems ok)
After a while I get:
29 | const CALL_INVOCATION_TRANSFORMER_SYMBOL = Symbol();
30 | function isFunction(arg) {
31 | return typeof arg === 'function';
32 | }
33 | function getErrorStackString(error) {
34 | return error.stack.split('\n').slice(1).join('\n');
^
TypeError: undefined is not an object (evaluating 'error.stack.split')
at getErrorStackString (/home/**REDACTED**/node_modules/@grpc/grpc-js/build/src/client.js:34:12)
at onReceiveStatus (/home/**REDACTED**/node_modules/@grpc/grpc-js/build/src/client.js:191:41)
at onReceiveStatus (/home/**REDACTED**/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:138)
at onReceiveStatus (/home/**REDACTED**/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:178)
at /home/**REDACTED**/node_modules/@grpc/grpc-js/build/src/resolving-call.js:99:75
Related:
It looks like we now get the response data into the http2 stream, but there seems to be a bug into PassThrough({ objectMode: true })
that prevent us to get the response.
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. Using bun 1.0.35 and firebase-admin 12.0.0
When I try to get the whole collection, it only returns part of it.
const serviceAccount = require(`./serviceAccountKey_dev.json`);
const app = admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});
const db = admin.firestore();
const cityRef = db.collection("cities").doc("SF");
const doc = await cityRef.get();
if (!doc.exists) {
console.log("No such document!");
} else {
console.log("Document data:", doc.data());
}
Error: 19 | const document_1 = require("./document"); 20 | const util_1 = require("./util"); 21 | const logger_1 = require("./logger"); 22 | /* 23 | A wrapper around BatchGetDocumentsRequest that retries request upon stream 24 | * failure and returns ordered results. ^ error: Did not receive document for "cities/SF".
now, with the latest version of bun, I get a similar error.
now, with the latest version of bun, I get a similar error.
I can confirm I see the same "did not recieve document for ..." error.
Firestore is a hugely popular document database, I'm very surprised this is not a higher priority for the Bun team.
Very eager to swap all of my projects (dev & prod) from Node to Bun, as this seems to be the only blocker.
related: #9228, #9393
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. 🥲
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!
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 bun
:(
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.
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...
bummer, was planning to migrate to bun
Getting error when trying to build the server with index.ts
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