nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
641 stars 98 forks source link

Nuxt generate timeout when using database serverside. #373

Closed sugoidesune closed 3 years ago

sugoidesune commented 3 years ago

Version

@nuxtjs/firebase: 7.1.0 firebase: 8.0.1 nuxt: 2.14.6

Reproduction Link

If you have a realtimedatabase setup add a line like the following to the fetch method. Usually you would continue getting data from it, butthis is not necessary for the bug to occur.

  async fetch () {
    var cardRef = this.$fire.database.ref('/cards/')
  }

Steps to reproduce

I tried all of the following but none are allowing nuxt generate to finish without a timeout:

    cardRef.off('value')
    this.$fire.database.off()
    this.$fire.database.off('value')
    this.$fire.database.off('/cards/')
    this.$fire.database.off('/cards/') 
    this.$fire.database.off(cardRef) 
    this.$fire.database.off(cardRef) 

to be more specific i am trying to use it like this:

    var cardRef = this.$fire.database.ref('/cards/')
    var snap = await cardRef.once('value')
    var data = snap.val()

What is Expected?

Nuxt generate finishes without a timeout.

What is actually happening?

Nuxt generate finishes with a timeout (will be an error in Nuxt 3)

lupas commented 3 years ago

Hey @sugoidesune

I just reopened the issue https://github.com/nuxt-community/firebase-module/issues/93 because I realized the issue still exists - I didn't face it lately but with using fetch() as you mentioned it indeed appears again.

In the mentioned issue you find a workaround - I'll try to figure out a way to fix this within the module itself.

Closing this issue in favour of https://github.com/nuxt-community/firebase-module/issues/93, let's continue the discussion there.