0

Can someone teach me why it says firebase.database is not a function?

    const firebase = require('firebase/app')
    require('firebase/auth')
    require('firebase/database')
    var config = {
            ......
    };
    firebase.initializeApp(config);

    var database = firebase.database();

    console.log(database)
Tredox
  • 1
  • 2
  • Does this answer your question? [firebase.database is not a function](https://stackoverflow.com/questions/38248723/firebase-database-is-not-a-function) – 1x2x3x4x Dec 25 '21 at 23:12
  • In Firebase v9, the API went under a drastic change. The Admin SDK is about to change too, but it still supports the legacy syntax for now as you've noticed. [See this question for more details](https://stackoverflow.com/questions/69240255/uncaught-typeerror-firebaseapp-firestore-is-not-a-function-when-integrating-f). Take care using the Admin SDK as it bypasses all security rules. – samthecodingman Dec 25 '21 at 23:46

1 Answers1

0

I've tried it with the npm module “firebase-admin”, now it works.

Tredox
  • 1
  • 2