nuxt-community / firebase-module

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

Error enabling offline persistence #557

Open adarsh4d opened 3 years ago

adarsh4d commented 3 years ago

I am using asyncData to fetch doc from firebase, it works perfectly on development, but when I try to host it on Vercel with ssr: true, I am getting the following error

dd4-ef8f-410a-853f-4e69a617036c WARN Error enabling offline persistence. Falling back to persistence disabled: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

I tried disabling the auth persistence, but the error is still there

Version

@nuxtjs/firebase: 6.1.1 firebase: 7.22.1 nuxt: 2.14.5

nuxt.config.js

firebase: {
    config: {
      apiKey: private,
      authDomain: private,
      projectId: private,
      storageBucket: private,
      messagingSenderId: private,
      appId: private,
      measurementId: private,
    },
    services: {
      auth: {
        persistence: 'none',
        initialize: { onAuthStateChangedAction: 'user/initializeData' },
        ssr: true,
      },
      firestore: {
        enablePersistence: false,
      },
      functions: { location: private },
      storage: true,
    },
  }

What is Expected?

The page should load with the correct data

What is actually happening?

The function timeout with the above-mentioned error

Any help would be much appreciated!! Thank you

simeon9696 commented 3 years ago

I don't think you can enable offline persistence on SSR because you'd be trying to persist data on the server, not the client

adarsh4d commented 3 years ago

Yeah understood, I am not trying to enable it. As you can see in my config above, I have set it to false on both firestore and auth, and still getting this error.