'Firebase v9 Database. ref is not a function?

I've started migrating over to v9 Modular firebase. Please see my config:

import { initializeApp } from 'firebase/app';
import { getDatabase } from "firebase/database";

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
..
};

const app = initializeApp(firebaseConfig);
// Get a reference to the database service
export const database = getDatabase(app);

Then in another file I made basic CRUD functions.

import { database } from "./firebase"

export const insertTestData = () => {
    return database.ref("test").set({name:"hello world"})
}

I got the following error:

Uncaught TypeError: _firebase__WEBPACK_IMPORTED_MODULE_0__.database.ref is not a function

Did I miss anything?

I'm not sure why it's also not picking up imports

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source