Skip to content

FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created #526

Answered by kmjennison
borjalo asked this question in Q&A
Discussion options

You must be logged in to vote

You're currently using the Firebase JS SDK during server-side rendering, but it's meant for use on the client side. You'll need to use useEffect:

import React, { useEffect } from 'react'
import { getAuth } from 'firebase/auth'

const ExamplePage = () => {
  useEffect(() => {
    const auth = getAuth()
    // ...
  })
  // ...
}

Here's the example we have in docs.

(Taken from this comment thread to make it easier for other people to find the answer.)

Replies: 4 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@borjalo
Comment options

@TobiasKrok
Comment options

@borjalo
Comment options

@kmjennison
Comment options

@borjalo
Comment options

Comment options

You must be logged in to vote
1 reply
@borjalo
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by kmjennison
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants