sitemap-module icon indicating copy to clipboard operation
sitemap-module copied to clipboard

@nuxtjs/sitemap - The command 'nuxt generate' finished but did not exit after 5s

Open simeon9696 opened this issue 2 years ago • 1 comments

I just added in the sitemap module and the warning at the end of this post came up. I'm not sure where to start with this one because the only change was adding in the sitemap module.

Here's my routes.generate:

generate: {
    async routes() {
      try {
        const { default: firebase } = await import('firebase/app')

        await import('firebase/firestore')
        const config = {
          apiKey: process.env.apiKey,
          authDomain: process.env.authDomain,
          databaseURL: process.env.databaseURL,
          projectId: process.env.projectId,
          storageBucket: process.env.storageBucket,
          messagingSenderId: process.env.messagingSenderId,
          appId: process.env.appId,
          measurementId: process.env.measurementId,
        }
        if (!firebase.apps.length) {
          firebase.initializeApp(config)
        }

        const app = firebase.apps[0]

        const qProducts = await app
          .firestore()
          .collection('products')
          .where('visible', '==', true)
          .get()
          
        if(qProducts.empty) return [];

        const products = qProducts.docs.map((doc) => {
          return {
            paylod: { ...doc.data(), id: doc.id },
            route: `/${doc.data().linkCategory}/${doc.data().linkName}`,
          }
        })

        return products
      } catch (error) {
        console.error(error)
      }
    },

My firebase config:

  firebase: {
    terminateDatabasesAfterGenerate: true,
    config: {
      apiKey: process.env.apiKey,
      authDomain: process.env.authDomain,
      databaseURL: process.env.databaseURL,
      projectId: process.env.projectId,
      storageBucket: process.env.storageBucket,
      messagingSenderId: process.env.messagingSenderId,
      appId: process.env.appId,
      measurementId: process.env.measurementId,
    },
    services: {
      analytics: true,
      performance: true,
      auth: {
        ssr: false,
        initialize: {
          onAuthStateChangedAction: 'auth/onAuthStateChangedAction',
        },
      },
      storage: {
        emulatorPort: process.env.NODE_ENV === 'development' ? 9199 : undefined,
        emulatorHost: 'localhost',
      },
      functions: {
        location: 'us-central1',
        emulatorPort: process.env.NODE_ENV === 'development' ? 5001 : undefined,
        emulatorHost: 'http://localhost',
      },

      firestore: {
        emulatorPort: process.env.NODE_ENV === 'development' ? 8080 : undefined,
        emulatorHost: 'localhost',
        enablePersistence: {
          synchronizeTabs: true,
        },
      },
    },
  },

My sitemap config:

    sitemap: {
    gzip:true,
    hostname: '<myhostnamehere>',
    exclude: [
      '/admin/**'
    ],
  },

Version

@nuxtjs/firebase: 7.6.1, firebase: 8.10.0 nuxt: 2.15.8

What is Expected?

The database terminates after generation

What is actually happening?

Getting this error: The command 'nuxt generate' finished but did not exit after 5s

╭──────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                      │
│   ⚠ Nuxt Warning                                                                     │
│                                                                                      │
│   The command 'nuxt generate' finished but did not exit after 5s                     │
│   This is most likely not caused by a bug in Nuxt                                    │
│   Make sure to cleanup all timers and listeners you or your plugins/modules start.   │
│   Nuxt will now force exit                                                           │
│                                                                                      │
│   DeprecationWarning: Starting with Nuxt version 3 this will be a fatal error        │
│                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────╯

simeon9696 avatar Sep 22 '21 15:09 simeon9696

i think i hit the same problem as you, do you found any answer ?

nelsonleong avatar Dec 27 '21 18:12 nelsonleong