I am trying to use Firebase in my Nodejs project but I keep getting an error and I cannot figure it out.
my firebase.ts
import firebase from 'firebase/app'
import "firebase/database"
const config = {
apiKey: "xxxxx",
authDomain: "xxxx.firebaseapp.com",
databaseURL: "https://xxxxx.firebaseio.com",
projectId: "xxxxx",
storageBucket: "xxxxx.appspot.com",
messagingSenderId: "xxxxx",
appId: "xxxxx"
};
firebase.initializeApp(config);
export const databaseRef = firebase.database();
export default firebase;
index.ts
export * from './firebase';
Where it is used
import { databaseRef } from '../../common/services/firebase'
await databaseRef.ref('dummy')
I got this error
TypeError: Cannot read property 'ref' of undefined
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…