Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firebase service storage is not available - React Js

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.

like image 987
Tonmoy Deb Avatar asked Nov 18 '25 11:11

Tonmoy Deb


1 Answers

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'],
  },
like image 88
Steve Avatar answered Nov 20 '25 02:11

Steve