Nuxt Generate finished but did not exit
See original GitHub issueThis may not be an issue, but might be more of a question. When I run npm run generate
I get the following error:
⚠ Nuxt Warning
The command 'nuxt generate' finished but did not exit after 5s
This is most likely not caused by a bug in Nuxt.js
Make sure to cleanup all timers and listeners you or your plugins/modules start.
Nuxt.js will now force exit
DeprecationWarning: Starting with Nuxt version 3 this will be a fatal error
I am not using Vuex, but I am using the onSnapshot
method, which is what I have narrowed the issue down to. It appears that the onSnapshot
method uses a listener which is causing the error. So I looked at the firebase docs and read the following - link:
var unsubscribe = db.collection("cities")
.onSnapshot(function (){
// Respond to data
// ...
});
// Later ...
// Stop listening to changes
unsubscribe();
So I tried to save the snapshot to something like this.destroySnapshot
, then in the beforeDestroy
lifecycle hook, call this.destroySnapshot()
. However, when I run npm run generate
again, it still gives me the same error.
So my real question is, is this an issue with Nuxt, Firebase, or me being a total noob? I am specifically worried about the line saying Starting with Nuxt version 3 this will be a fatal error
If you want to see my code, it is in my nuxt-sandbox repo.
And more than anything, thank you for creating Nuxt-Fire.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:10 (4 by maintainers)
If looking for a similar solution with Firestore, you can use firedb.terminate() instead of ‘goOffline()’ in the nuxt.config.js hook mentioned above =) (Thanks for this thread, helped me a lot!)
@krisism Awesome, I was actually looking for that since the issue is also there with Firestore. Thanks for the tip!
Still trying to find a way to call this in the generate.done hook though since this.$fireStore is not accessible there…
https://github.com/nuxt-community/firebase-module/issues/93 is open for trying to fix this within this module.