Skip to content

TypeError: undefined is not an object(evaluating ‘_$$_REQUIRE(_dependencyMap[9], “../../config/FIREBASE”).FIREBASE.database’)

I have installed Firebase with npm in Firebase, but I don’t know what happens with this error.


// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
// TODO: Add SDKs for Firebase products that you want to use

// Your web app's Firebase configuration
const firebaseConfig = {
    apiKey: "AIzaSyAd2EBoYYCRWEc3oClZTV3Wo-TiQkM2MgQ",
    authDomain: "",
    databaseURL: "",
    projectId: "crud-react-26836",
    storageBucket: "",
    messagingSenderId: "741718079918",
    appId: "1:741718079918:web:1566301b46c4448c8c703f"

// Initialize Firebase
const FIREBASE = initializeApp(firebaseConfig);
export default FIREBASE;


import React, { Component } from 'react'
import { StyleSheet, View, TouchableOpacity, Text, Alert } from 'react-native'
import { InputData } from '../../component'
import { FIREBASE } from '../../config/FIREBASE'

onSubmit = () => {
    if (this.state.nama && this.state.nomorHP && this.state.alamat) {
        console.log("Masuk Submit");
        const kontakReferensi = FIREBASE.database().ref('kontak');



You aren’t using the new Modular/Functional syntax which is included from version 9.0.0+. You would have to rewrite your code to follow the new syntax:

import { getDatabase } from "firebase/database"

const dbRef = ref(getDatabase());
const snapshot = await get(child(dbRef, 'kontak'))

If you want to use the existing code (with older syntax) then use compat version by changing the imports to:

import firebase from 'firebase/compat/app'
import 'firebase/compat/database'
import 'firebase/compat/[SERVICE_NAME]'

const FIREBASE = firebase.initializeApp(firebaseConfig);
export default FIREBASE;

I’d recommend using the new version and following the documentation for learning more about it.

User contributions licensed under: CC BY-SA
5 People found this is helpful