I am trying to use firebase storage with React JS. but there is a error like this. service storage is not available
here is my firebase config file.
import { initializeApp } from "firebase/app";
import { Auth, getAuth } from "firebase/auth";
import { Firestore, getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
// web app's Firebase configuration
const firebaseConfig = {
apiKey: import.meta.env.VITE_API_KEY,
authDomain: import.meta.env.VITE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_PROJECT_ID,
storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
appId: import.meta.env.VITE_APP_ID,
};
// Initialize Firebase
export const firebase = initializeApp(firebaseConfig);
// exports
export const auth: Auth = getAuth(firebase);
export const db: Firestore = getFirestore(firebase);
export const storage = getStorage(firebase);
I have checked all the configs & everything is ok. Also I reinstalled the firebase package but nothing works out.
This was an issue for me also with the theme of multiple versions of the firebase package. Deleting a lock file was not a solution for me.
For vite users the resolve.dedupe config option will help resolve this issue.
resolve: {
dedupe: ['firebase'],
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With