Question: `
import { initializeApp, getApps } from 'firebase/app';
import { getStorage } from 'firebase/storage';

const firebaseConfig = {
apiKey: 'key',
authDomain: 'facebook-clone-nextjs-2dcc9.firebaseapp.com',
projectId: 'facebook-clone-nextjs-2dcc9',
storageBucket: 'facebook-clone-nextjs-2dcc9.appspot.com',
messagingSenderId: '662489031143',
appId: '1:662489031143:web:ae71393e61a214e3f35d42',
measurementId: 'G-VFB246J0M5',
};

const firebaseApp = initializeApp(firebaseConfig);

const db = getStorage(firebaseApp);

export { db };

 const sendpost = (e) => {
e.preventDefault();
if (!inputRef.current.value) return;

```
    db.collection('post').add({
        message: inputRef.current.value,
        name: session.user.name,
        email: session.user.email,
        image: session.user.image,
        timestamp: firebase.firestore.fieldValue.serverTimestamp(),
    });
    inputRef.current.value = '';

};

```

`

Answer: 
The issues are:

* You are using modular SDK so you cannot use `db.collection()`
* You should use `getFirestore` to get an instance of Firestore but you are using `getStorage` which will get an instance of Storage.

Try refcatoring your code to this:

```
import { getFirestore, collection } from "firebase/firestore"

const db = getFirestore(app)

const colRef = collection(db, "posts")

await addDoc(colRef, {
  ...yourDataObject
});

```

You can learn more about the new syntax in the [documentation](https://firebase.google.com/docs/firestore/manage-data/add-data#add_a_document)
You should use `getFirestore` to get an instance of `Firestore`, but you are using `getStorage` which will get an instance of `Storage`.