0

firestore のコレクションに基づいて、Nuxt.js でルートを動的に生成しています。すべて正常に生成されますが、この警告が表示されます。

   ╭──────────────────────────────────────────────────────────────────────────────────────╮
   │                                                                                      │
   │   ⚠ 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        │
   │                                                                                      │
   ╰──────────────────────────────────────────────────────────────────────────────────────╯

この投稿からのアドバイスに従って、次のスニペットを追加しました。

export default {
  hooks: {
    generate: {
      done(builder) {
        firebase.firestore.terminate()
      }
    }
  },
}

しかし、それは致命的なエラーを引き起こします:

 FATAL  The client has already been terminated.                                                                                       23:39:58  

  at new FirestoreError (node_modules\@firebase\firestore\dist\index.node.cjs.js:1201:28)
  at FirestoreClient.verifyNotTerminated (node_modules\@firebase\firestore\dist\index.node.cjs.js:17311:19)
  at FirestoreClient.listen (node_modules\@firebase\firestore\dist\index.node.cjs.js:17371:14)
  at CollectionReference.Query$1.onSnapshotInternal (node_modules\@firebase\firestore\dist\index.node.cjs.js:21820:48)
  at CollectionReference.Query$1.getViaSnapshotListener (node_modules\@firebase\firestore\dist\index.node.cjs.js:21851:29)
  at node_modules\@firebase\firestore\dist\index.node.cjs.js:21846:23
  at new Promise (<anonymous>)
  at CollectionReference.Query$1.get (node_modules\@firebase\firestore\dist\index.node.cjs.js:21836:16)
  at routes (nuxt.config.js:185:79)
  at promisifyRoute (node_modules\@nuxtjs\sitemap\lib\cache.js:59:17)
  at AsyncCache.load [as _load] (node_modules\@nuxtjs\sitemap\lib\cache.js:18:28)
  at AsyncCache.get (node_modules\async-cache\ac.js:63:8)
  at internal/util.js:297:30
  at new Promise (<anonymous>)
  at AsyncCache.get (internal/util.js:296:12)
  at generateSitemap (node_modules\@nuxtjs\sitemap\lib\generator.js:54:37)


   ╭────────────────────────────────────────────────────────────────────────────────────────╮
   │                                                                                        │
   │   ✖ Nuxt Fatal Error                                                                   │
   │                                                                                        │
   │   FirebaseError: [code=failed-precondition]: The client has already been terminated.   │
   │                                                                                        │
   ╰────────────────────────────────────────────────────────────────────────────────────────╯

これは、この質問の一部を抜粋した私のルート メソッドです。

generate: {
    async routes() {
      const collection = await db.collection('restaurants').get();
      return collection .docs.map(x => `/restaurant/${x.title}`);
    }
},

この警告は、生成オブジェクトを追加したときにのみ表示されたため、問題がその領域にあることがわかりました。助言がありますか?

編集:Firebaseの初期化コードnuxt.config.js

import firebase from 'firebase/app'
import 'firebase/firestore'

const config = {
  apiKey: '',
  authDomain: '',
  databaseURL: '',
  projectId: '',
  storageBucket: '',
  messagingSenderId: '',
  appId: '',
  measurementId: ''
};
firebase.initializeApp(config);
const fireDb = firebase.firestore();

export default {
    generate :{...}
}
4

4 に答える 4

1

それでもサポートが必要な場合は、https ://firebase.google.com/support/troubleshooter/contact から無料サポートを提供している Firebase に直接お問い合わせください。

于 2020-05-25T19:06:40.433 に答える