I'm trying to enable offline persistence on a web app with Nuxt.js
. However, I get an error:
Error enabling offline persistence. Falling back to persistence disabled: FirebaseError: [code=unimplemented]:
This platform is either missing IndexedDB or is known to have an incomplete implementation.
Offline persistence has been disabled.
My code in the firebase.js
in the plugins
directory is:
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();
fireDb.enablePersistence()
.catch(function(err) {
if (err.code == 'failed-precondition') {
// Multiple tabs open, persistence can only be enabled
// in one tab at a a time.
// ...
console.log(err.code);
} else if (err.code == 'unimplemented') {
// The current browser does not support all of the
// features required to enable persistence
// ...
console.log(err.code);
}
});
export{fireDb}
How can I fix this error? It should be noted that reading from or writing to firestore works fine