maxkomarychev / react-native-ultimate-config

Config that works
MIT License
260 stars 31 forks source link

Firebase Initialization Issue with react-native-ultimate-config in NX Monorepo #145

Open quicksilverr opened 6 months ago

quicksilverr commented 6 months ago

I am encountering an error related to Firebase initialization after integrating the react-native-ultimate-config package to handle multiple apps and environments in an NX Monorepo setup. The error message states: "ERROR Error: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp()".

This issue seems to be specific to the Android platform, as iOS is working correctly. I have provided details of my package.json, build.gradle, and the filepath for the google-services.json files. The problem arises after introducing react-native-ultimate-config into the project.

The error persists despite proper Firebase configuration and initialization. I would appreciate any guidance or insights into resolving this issue, as it hinders the proper functioning of the Android app. If there are specific configurations or workarounds needed for NX Monorepo compatibility, please provide instructions.

Steps to Reproduce:

Add react-native-ultimate-config package to the project. Integrate Firebase for multiple apps and environments. Run the Android app in an NX Monorepo environment. Expected Behavior: Firebase should be initialized successfully, and the Android app should run without encountering the mentioned error.

Actual Behavior: The error "No Firebase App '[DEFAULT]' has been created" occurs, indicating an issue with Firebase initialization specifically on the Android platform in the presence of react-native-ultimate-config.

Additional Information:

Package versions and configurations for Firebase, NX, and related dependencies. Any suggested workarounds or configurations that may address the issue.

Google-services Json File Path

apps/app-name/android/app/google-services.json

Build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33
        kotlinVersion = "1.8.20"

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
        classpath 'com.google.gms:google-services:4.4.0'
    }
}

allprojects {
    repositories {
        maven {
            // https://wix.github.io/Detox/docs/introduction/project-setup
            url("$rootDir/../node_modules/detox/Detox-android")
        }        
    }
}

Package Json

"dependencies": {
    "@babel/plugin-proposal-export-default-from": "^7.18.10",
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@bugsnag/plugin-react": "^7.18.0",
    "@emotion/react": "11.11.1",
    "@emotion/styled": "11.11.0",
    "@gorhom/bottom-sheet": "^4",
    "@mui/material": "^5.10.12",
    "@notifee/react-native": "^7.2.0",
    "@nx/node": "16.6.0",
    "@react-google-maps/api": "^2.18.1",
    "@react-native-async-storage/async-storage": "1.19.0",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/blur": "^4.3.2",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/geolocation": "^3.0.3",
    "@react-native-community/netinfo": "^9.3.6",
    "@react-native-firebase/app": "^18.7.3",
    "@react-native-firebase/messaging": "^18.7.3",
    "@react-native-masked-view/masked-view": "^0.2.8",
    "@react-native-picker/picker": "^2.5.0",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/devtools": "^6.0.10",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/elements": "^1.3.13",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@react-navigation/stack": "^6.3.4",
    "@reduxjs/toolkit": "1.9.3",
    "@rneui/base": "^4.0.0-rc.8",
    "@rneui/themed": "^4.0.0-rc.8",
    "@shopify/flash-list": "^1.6.3",
    "@shopify/react-native-skia": "^0.1.170",
    "@storybook/core-server": "7.5.3",
    "@tanstack/react-table": "^8.9.2",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "@types/pubnub": "^7.2.0",
    "@types/react-date-range": "^1.4.4",
    "@types/react-native-vector-icons": "^6.4.12",
    "axios": "^0.27.2",
    "buffer": "6.0.3",
    "circular-dependency-plugin": "^5.2.2",
    "core-js": "^3.6.5",
    "csvtojson": "^2.0.10",
    "d3": "^7.6.1",
    "date-fns": "^2.30.0",
    "dpdm": "^3.10.0",
    "file-saver": "2.0.5",
    "freerasp-react-native": "^3.4.0",
    "ga-4-react": "^0.1.281",
    "html-react-parser": "^4.0.0",
    "localforage": "^1.10.0",
    "lodash": "^4.17.21",
    "lottie-react-native": "^6.2.0",
    "moment": "^2.29.4",
    "moment-timezone": "^0.5.38",
    "npm-check-updates": "^16.3.16",
    "nx": "16.6.0",
    "prop-types": "^15.8.1",
    "pubnub": "^7.2.0",
    "pubnub-react": "^3.0.1",
    "query-string": "8.1.0",
    "randomcolor": "^0.6.2",
    "rc-datepicker": "^5.0.16",
    "react": "18.2.0",
    "react-bootstrap": "^2.6.0",
    "react-date-range": "^1.4.0",
    "react-datepicker": "^4.8.0",
    "react-dom": "18.2.0",
    "react-gradient-text": "^0.1.0",
    "react-iframe-comm": "^1.2.2",
    "react-image-file-resizer": "^0.4.8",
    "react-joyride": "^2.5.4",
    "react-json-csv": "^2.0.0",
    "react-localization": "^1.0.19",
    "react-modern-drawer": "^1.1.2",
    "react-native": "0.72.3",
    "react-native-android-location-services-dialog-box": "^2.8.2",
    "react-native-asset": "^2.0.1",
    "react-native-blob-util": "^0.16.4",
    "react-native-bootsplash": "^4.3.3",
    "react-native-chart-kit": "^6.12.0",
    "react-native-communications": "2.2.1",
    "react-native-config": "1.5.0",
    "react-native-confirmation-code-field": "^7.3.1",
    "react-native-copilot": "^3.2.1",
    "react-native-countdown-circle-timer": "^3.0.9",
    "react-native-countdown-component": "^2.7.1",
    "react-native-device-info": "^10.12.0",
    "react-native-document-picker": "^8.1.2",
    "react-native-easy-icon": "^1.0.10",
    "react-native-encrypted-storage": "^4.0.3",
    "react-native-exit-app": "^2.0.0",
    "react-native-extended-stylesheet": "^0.12.0",
    "react-native-fast-image": "^8.6.3",
    "react-native-flipper": "^0.174.0",
    "react-native-floating-action": "^1.22.0",
    "react-native-flurry-sdk": "^8.0.0",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "2.9.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-gifted-chat": "^1.0.4",
    "react-native-image-crop-picker": "^0.38.1",
    "react-native-image-resizer": "^1.4.5",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-localization": "^2.3.1",
    "react-native-maps": "^1.3.2",
    "react-native-masked-text": "^1.13.0",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "^6.2.1",
    "react-native-paper": "^4.12.5",
    "react-native-paper-dates": "^0.9.2",
    "react-native-parallax-header": "^1.1.4",
    "react-native-parsed-text": "0.0.22",
    "react-native-permissions": "^4.0.0",
    "react-native-pg-react-native-sdk": "^2.1.10",
    "react-native-reanimated": "3.4.2",
    "react-native-reanimated-carousel": "3.1.5",
    "react-native-rename": "^3.2.13",
    "react-native-render-html": "^6.3.4",
    "react-native-responsive-fontsize": "^0.5.1",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "4.7.1",
    "react-native-screens": "3.18.0",
    "react-native-share": "^8.0.0",
    "react-native-shimmer-placeholder": "^2.0.9",
    "react-native-sidebar-navigator": "^0.2.1",
    "react-native-step-indicator": "^1.0.3",
    "react-native-swiper": "^1.6.0",
    "react-native-tab-view": "^3.3.0",
    "react-native-ultimate-config": "6.0.1",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "^0.18.10",
    "react-native-web-hover": "^0.2.9",
    "react-native-web-linear-gradient": "^1.1.2",
    "react-native-web-maps": "^0.3.0",
    "react-native-webview": "^11.23.1",
    "react-otp-input": "^2.4.0",
    "react-player": "^2.12.0",
    "react-redux": "8.0.5",
    "react-router-dom": "6.11.2",
    "react-table": "^7.8.0",
    "react-window": "^1.8.8",
    "react-window-infinite-loader": "^1.0.8",
    "reactjs-popup": "^2.0.5",
    "recharts": "^2.1.16",
    "redux": "^4.2.0",
    "redux-flipper": "^2.0.2",
    "redux-persist": "^6.0.0",
    "redux-thunk": "2.4.2",
    "regenerator-runtime": "0.13.7",
    "reselect": "^4.1.7",
    "sp-react-native-in-app-updates": "^1.3.1",
    "tslib": "^2.6.0",
    "uuid": "^9.0.0",
    "victory": "^36.6.8",
    "victory-native": "^36.6.8",
    "yarn": "^1.22.19"
  },
  "devDependencies": {
    "@babel/core": "7.20.2",
    "@babel/helper-replace-supers": "^7.22.20",
    "@babel/plugin-proposal-class-properties": "^7.18.6",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
    "@babel/plugin-proposal-object-rest-spread": "^7.20.2",
    "@babel/plugin-proposal-optional-chaining": "^7.21.0",
    "@babel/plugin-syntax-flow": "^7.22.5",
    "@babel/preset-env": "^7.20.2",
    "@babel/preset-flow": "^7.18.6",
    "@babel/preset-react": "^7.18.6",
    "@babel/preset-typescript": "^7.18.6",
    "@nx/cypress": "16.6.0",
    "@nx/detox": "16.6.0",
    "@nx/eslint-plugin": "16.6.0",
    "@nx/jest": "16.6.0",
    "@nx/js": "16.6.0",
    "@nx/linter": "16.6.0",
    "@nx/react": "16.6.0",
    "@nx/react-native": "16.6.0",
    "@nx/storybook": "16.6.0",
    "@nx/web": "16.6.0",
    "@nx/webpack": "16.6.0",
    "@nx/workspace": "16.6.0",
    "@react-native-community/cli": "11.3.5",
    "@react-native-community/cli-platform-android": "11.3.5",
    "@react-native-community/cli-platform-ios": "11.3.5",
    "@react-native/metro-config": "^0.72.9",
    "@storybook/addon-essentials": "7.5.3",
    "@storybook/react": "7.5.3",
    "@storybook/react-webpack5": "7.5.3",
    "@svgr/webpack": "^6.5.1",
    "@testing-library/jest-dom": "5.16.5",
    "@testing-library/jest-native": "5.4.2",
    "@testing-library/react": "14.0.0",
    "@testing-library/react-native": "12.1.2",
    "@types/d3": "^7.4.0",
    "@types/jest": "29.4.4",
    "@types/lodash": "^4.14.188",
    "@types/node": "18.14.4",
    "@types/react": "18.2.14",
    "@types/react-dom": "18.2.6",
    "@types/react-native": "0.72.2",
    "@types/react-native-countdown-component": "^2.7.0",
    "@types/react-native-snap-carousel": "^3.8.5",
    "@types/react-router-dom": "5.3.3",
    "@types/react-table": "^7.7.12",
    "@types/react-window": "^1.8.5",
    "@types/react-window-infinite-loader": "^1.0.6",
    "@types/uuid": "^8.3.4",
    "@typescript-eslint/eslint-plugin": "5.62.0",
    "@typescript-eslint/parser": "5.62.0",
    "babel-jest": "29.4.3",
    "babel-loader": "^9.1.0",
    "babel-plugin-module-resolver": "^4.1.0",
    "babel-plugin-react-native-web": "^0.18.10",
    "cypress": "^12.2.0",
    "detox": "20.13.5",
    "eslint": "8.27.0",
    "eslint-config-prettier": "8.5.0",
    "eslint-plugin-cypress": "^2.12.1",
    "eslint-plugin-import": "2.27.5",
    "eslint-plugin-jsx-a11y": "6.7.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "4.6.0",
    "eslint-plugin-storybook": "^0.6.13",
    "jest": "29.4.3",
    "jest-circus": "^29.4.1",
    "jest-environment-jsdom": "29.4.3",
    "jest-jasmine2": "29.4.3",
    "jest-react-native": "18.0.0",
    "metro": "0.76.7",
    "metro-babel-register": "0.76.7",
    "metro-react-native-babel-preset": "0.76.7",
    "metro-react-native-babel-transformer": "0.76.7",
    "metro-resolver": "0.76.7",
    "ncp": "^2.0.0",
    "nx": "16.6.0",
    "nx-cloud": "16.5.2",
    "patch-package": "^6.5.0",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "2.7.1",
    "react-native-flipper-performance-plugin": "^0.4.0",
    "react-native-svg": "13.9.0",
    "react-native-svg-transformer": "1.0.0",
    "react-test-renderer": "18.2.0",
    "ts-jest": "29.1.1",
    "ts-node": "10.9.1",
    "typescript": "5.1.6",
    "url-loader": "^4.1.1",
    "webpack": "5.75.0"
  },