Skip to content

Hot reload on server caused No Firebase App has been created #1596

Open
@praburangki

Description

Reproduction

https://github.com/praburangki/vuefire/tree/issue/session-cookie

Steps to reproduce the bug

I've forked this repo and put it in a different branch issue/session-cookie.
I'm trying to build a repository pattern where I want to centralized my API calls.
In order to call these repos I need to put it in a nuxt plugin. These API calls will be needed either in server side & client side.

I also have a backend in the server folder to define my endpoints. While developing within the server, all works perfectly fine including the hot reload. The issue rises when the user is logged in.

Here are the steps to reproduce:

  1. Go to authentication page
  2. Click Signin Google (popup)
  3. Login
  4. Go to one of the files in the server folder and do some minor changes (e.g. adding console.log) and save it
  5. Refresh the page

Expected behavior

I did a check in Nuxt's devtools in the plugins sections I can see all of the vuefire plugins is already loaded then it's loading my API repository plugin. Within those vuefire plugins it's already calling initializeApp()

Actual behavior

You will get an error: "Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app)".

The workaround that I did is open chrome devtools, go to cookies and delete the __session cookie. Refresh the page and the error is gone.

Yes I do have the service-account.json file.

Additional information

No response

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