Nuxt Generate + RealtimeDatabase / Firestore results in "Nuxt Generate finished but did not exit"
See original GitHub issueWhen using nuxt generate
, the following warning appears at the end (after a successful generate)
Problem

⚠ 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
Possible Solution
It can theoretically be fixed by calling goOffline()
for RealtimeDb or terminate()
for Firestore after the generate:done
hook.
export default {
hooks: {
generate: {
done(builder) {
$fireDb.goOffline()
$fireStore.goOffline()
}
}
},
- Problem now is: How do we access
$fireDb
or$fireStore
in this hook and how do we implement this in nuxt-firebase?
Might be a big issue when Nuxt v3 arrives.
(Originated from https://github.com/lupas/nuxt-fire/issues/90#issuecomment-590052067)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:26 (11 by maintainers)
Top Results From Across the Web
Nuxt Generate finished but did not exit #90 - GitHub
I am not using Vuex, but I am using the onSnapshot method, which is what I have narrowed the issue down to. It...
Read more >Nuxt generate and firebase gives timer warning - Stack Overflow
So that I can generate dynamic routes. So there's a collection in my database called restaurants and I want each restaurant to have...
Read more >Options - Nuxt Firebase
Your firebase config snippet and other Firebase specific parameters. ... The command 'nuxt generate' finished but did not exit after 5s This is...
Read more >Firebase - Nuxt.js Succinctly Ebook - Syncfusion
Learn about overview, getting started with firebase and adding data in the chapter "Firebase" of Syncfusion Nuxt.js free ebook.
Read more >Building User Accounts with Nuxt, Vuex, and Firebase
Recently, I was working to implement user accounts into my application I've been building with Nuxt as the frontend and Firebase for the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Alright guys, so I found a way to make this work without having to create any additional files. Just do the following in your
nuxt.config.js
:What I am doing is:
builder.options.firebase.config
./.nuxt/firebase/app.js
goOffline()
/terminate()
on RealtimeDatabase and Firestore through that instanceI assume that with Nuxt 3 the API and possibly the hooks will change quite a bit so that this has to be reevaluated anyway (maybe we can access the context in the hooks then?). Until Nuxt 3 is released (possibly around Q1 2021) this should be a good workaround.
ToDo’s
generate:done
hookSo a short-term solution I’ve determined from these two posts is:
{project_root}/firebase.config.js
:plugins/firebaseInit.js
file:nuxt.config.js
to import the config file and add a generate.done() hook around the plugin: