You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Initialize Firebase
const { auth, db } = initializeFirebase(firebaseConfig);
// Attempt to use auth and db
console.log(auth, db);
Expected Behavior
I expect the Firebase app to be initialized, and the auth and db services to be available for use without throwing any errors.
Actual Behavior
The error FirebaseError: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app) is thrown, indicating that Firebase is not properly initialized.
Package Code
Here is the relevant part of the refine-firebase-adapter package code:
src/firebase/firebaseconfig.ts:`
`import { initializeApp, FirebaseApp } from 'firebase/app';
import { getAuth, Auth } from 'firebase/auth';
import { getFirestore, Firestore } from 'firebase/firestore';
let app: FirebaseApp | null = null;
let auth: Auth;
let db: Firestore;
const initializeFirebase = (firebaseConfig: any) => {
if (!app) {
app = initializeApp(firebaseConfig);
auth = getAuth(app);
db = getFirestore(app);
}
return { auth, db };
};
export { initializeFirebase, auth, db };
`
src/index.ts:
export { default as authprovider } from './authprovider/authprovider'; export { default as dataprovider } from './dataprovider/dataprovider'; export { initializeFirebase, auth, db } from './firebase/firebaseconfig';
Additional Context
I have ensured that initializeFirebase is called before any Firebase services are used.
The configuration object is correctly provided.
The issue persists even after re-publishing the package and reinstalling dependencies.
Environment
Node version: [e.g., 14.x]
npm version: [e.g., 6.x]
Package version: [e.g., 1.0.0]
Firebase version: [e.g., 9.6.1]
Any guidance or help to resolve this issue would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered:
Description
I am encountering the following error when using the refine-firebase-adapter package in my project:
FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app)
This error occurs even though I have called the initializeFirebase function before using any Firebase services.
Steps to Reproduce
Example Code
Here is a simplified version of my code:
`import { initializeFirebase } from 'refine-firebase-adapter';
const firebaseConfig = {
apiKey: "apikey",
authDomain: "key",
projectId: "key",
storageBucket: "key",
messagingSenderId: "key",
appId: "key"
};
// Initialize Firebase
const { auth, db } = initializeFirebase(firebaseConfig);
// Attempt to use
auth
anddb
console.log(auth, db);
Expected Behavior
I expect the Firebase app to be initialized, and the auth and db services to be available for use without throwing any errors.
Actual Behavior
The error FirebaseError: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app) is thrown, indicating that Firebase is not properly initialized.
Package Code
Here is the relevant part of the refine-firebase-adapter package code:
src/firebase/firebaseconfig.ts:`
`import { initializeApp, FirebaseApp } from 'firebase/app';
import { getAuth, Auth } from 'firebase/auth';
import { getFirestore, Firestore } from 'firebase/firestore';
let app: FirebaseApp | null = null;
let auth: Auth;
let db: Firestore;
const initializeFirebase = (firebaseConfig: any) => {
if (!app) {
app = initializeApp(firebaseConfig);
auth = getAuth(app);
db = getFirestore(app);
}
return { auth, db };
};
export { initializeFirebase, auth, db };
`
src/index.ts:
export { default as authprovider } from './authprovider/authprovider'; export { default as dataprovider } from './dataprovider/dataprovider'; export { initializeFirebase, auth, db } from './firebase/firebaseconfig';
Additional Context
I have ensured that initializeFirebase is called before any Firebase services are used.
The configuration object is correctly provided.
The issue persists even after re-publishing the package and reinstalling dependencies.
Environment
Node version: [e.g., 14.x]
npm version: [e.g., 6.x]
Package version: [e.g., 1.0.0]
Firebase version: [e.g., 9.6.1]
Any guidance or help to resolve this issue would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered: