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

Error enabling offline persistence

Open adarsh4d opened this issue 3 years ago • 2 comments

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

adarsh4d avatar Jun 28 '21 18:06 adarsh4d

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

simeon9696 avatar Jul 01 '21 12:07 simeon9696

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.

adarsh4d avatar Jul 01 '21 12:07 adarsh4d