firebase-admin-node: bun.sh grpc-js :: undefined is not an object (evaluating 'error.stack.split') :: what am I missing?
[REQUIRED] Step 2: Describe your environment
- Operating System version: macOS 13.5.2 (22G91)
- Firebase SDK version: 11.10.1
- Firebase Product: firestore
- Node.js version: 18.17.1
- NPM version: 8.19.2
[REQUIRED] Step 3: Describe the problem
I’m testing out bun and I can’t do a basic get() on a collection. What am I missing?
Steps to reproduce:
index.ts
require('dotenv').config()
import { initializeApp } from 'firebase-admin/app'
initializeApp()
import { getFirestore } from 'firebase-admin/firestore'
export const db = getFirestore()
db.collection('category').get()
Run
bun index.ts
[0.05ms] ".env"
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 (/path/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/client.js:34:11)
at onReceiveStatus (/path/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/client.js:356:40)
at onReceiveStatus (/path/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:177)
at /path/node_modules/google-gax/node_modules/@grpc/grpc-js/build/src/resolving-call.js:94:74
at processTicksAndRejections (:1:2602)
About this issue
- Original URL
- State: open
- Created 10 months ago
- Reactions: 15
- Comments: 23 (1 by maintainers)
I’d want to use bun.sh but not being able to use firebase-admin really is blocking
Agreed. There is a discussion ongoing there already regarding this. https://github.com/oven-sh/bun/issues/4746
Still seeing this on bun
1.0.25
and firebase-admin12.0.0
same for
@google-cloud/firestore
package, version 1.0.18Things are improving (with improved http2/gRPC support in bun.sh 1.0.14) but firestore snapshots are still hanging.
Just because this is first on google, but please do checkout the discussion on bun’s repo https://github.com/oven-sh/bun/issues/4746
TL;DR:
Error.prototype.stack = '';
early in the program should fix this. (prevents the error but wont restore your stack trace, try-catch it yourself)If you’re curious here is a nice rabbit hole to go down
Ditto here… unable to use the firebase-admin SDK for firestore.
Firebase Admin SDK requires a full Node.js runtime and currently not supported on other alternative JS environments.
I’m having this exact same issue as well when trying to use the
@google-analytics/admin
package just by doing a simple reportawait analyticsDataClient.runReport({...})
I thought Bun wasn’t going to work with grpc yet because of missing HTTP2 support?
Might be related to your issue.
Hope they support it soon though!