Short answer
Initialize Firebase in one module and reuse it: check getApps() first, and return the existing app with getApp() if one is already set up. Make sure every place that initializes Firebase uses the same config, and give a second project its own app name.
Rather not fix it yourself? App Fix Ticket fixes one reproducible bug at a fixed price, with an optional Diagnosis that is credited toward the fix.
Why Firebase sees two different configs, and the fix
01
The setup code runs more than once
“If a FirebaseApp already exists with the same name but with a different configuration.” Firebase, Firebase JS SDK reference: initializeApp (Exceptions)
Server rendering, hot reload or importing the setup from two entry points can call initializeApp again. With identical config the SDK just returns the existing app; it throws only when the options or config differ between calls. Guard the call with getApps() and getApp() so one config is used everywhere.
import { initializeApp, getApps, getApp } from 'firebase/app'; export const app = getApps().length ? getApp() : initializeApp(firebaseConfig);02
Two configs for the same app
A config file and environment variables, or a staging and a production config, loaded in the same app clash on the default name. The SDK’s error message names the setting that differs and shows the existing and the new value, so compare them and keep one.
03
A second project needs its own name
Using two Firebase projects in one app is allowed, but each needs a separate app name. Pass a name as the second argument for the extra project.
const analyticsApp = initializeApp(otherConfig, 'analytics');04
The same error in Flutter
Also check: in Flutter the same error reads [core/duplicate-app]. FlutterFire throws it only when the options passed to Firebase.initializeApp differ from an app that already exists, including a default app created on the native side. Make the Dart options match the platform config files, and give a second project its own app name.
Checked against the vendor’s docs on : Firebase JS SDK reference: firebase/app; Firebase JS SDK source: app errors; Firebase JS SDK source: initializeApp; FlutterFire source: firebase_core initializeApp.
Rather hand it over?
Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.
- from $450App Fix TicketOne reproducible bug. The Fix costs $1,200. If you need a Diagnosis first, its $450 fee counts toward the Fix.See scope and start
- from $450AI-Built App RescueFor a whole-app review, the $450 Launch Check is credited toward the optional $1,950 Rescue Sprint for up to five critical or high findings.No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.See scope and start
“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
Related: Firebase No App [DEFAULT] has been created · Firebase invalid API key in production · FlutterFire configure FirebaseCommandException · Firebase Hosting site not updating