firebase.storage() error firebase.storage is not a function in Next.js

Asked 2 years ago, Updated 2 years ago, 120 views

I was able to use firebase.storage() in React (firebase7.20.0), but even though I wrote the same code in Next.js, I got an error message for firebase.storage is not a function.

What is the cause?

firebase 7.23.0

import firebase from "firebase";

// For Firebase JS SDK v7.20.0 and later, measurementId is optional
constfirebaseConfig={
 // config
};

constfirebaseApp=!firebase.apps.length
  ? firebase.initializeApp(firebaseConfig)
  : firebase.app();

const db = firebaseApp.firestore();
const auth = firebase.auth();
const provider = new firebase.auth.GoogleAuthProvider();
const storage=firebaseApp.storage()

export {auth, provider, storage};

export default db;

reactjs firebase next.js

2022-09-30 15:04

1 Answers

import "firebase/storage";
I think it's because I don't have this one.


2022-09-30 15:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.