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)
2
  • Does this answer your question? firebase.database is not a function Commented Dec 25, 2021 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. Take care using the Admin SDK as it bypasses all security rules. Commented Dec 25, 2021 at 23:46

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.