Skip to content

Firebase App named '[DEFAULT]' already exists (app/duplicate-app) #1999

@martinvarelaaaa

Description

@martinvarelaaaa

I started a project based on https://github.com/zeit/next.js/tree/v3-beta/examples/with-firebase

The error I have when importing firebase in more than one component.

In this firebase start file:

`import firebase from 'firebase'

const firebaseConfig = {
apiKey: "fdsfsdfdsf",
authDomain: "fdsfdsfsdfdsf",
databaseURL: "sdfdsfdsf",
projectId: "dsfdsfdsf",
storageBucket: "dsfdsfdsf",
messagingSenderId: "dsfdsfsdfdsf"
}

const FbApp = firebase.initializeApp(firebaseConfig)

export default FbApp.auth()`

Then in the components:

import firebase from '../lib/firebaseClient'

With a single component works well, but if I add a new component with import firebase from '../lib/firebaseClient' the application fail:

Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app).
FirebaseError: Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions