Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

350
Vistas
firebase firestore offline persistence FirebaseError

I searched for several hours to implement firestore offline persistence because its crucial for my app to work. I handle multiple chats inside my app and its a fatal error to download data every time again.

This is my code sample, its the root App.js file which is the first one beeing called:

....
//imports related to firebase
import * as firebase from "firebase";
import ApiKeys from "./constants/ApiKeys";


export default function App() {
  //firebase project initialisation
  if (!firebase.apps.length) {
    firebase.initializeApp(ApiKeys);
    var db = firebase.firestore();
    db.settings({ experimentalForceLongPolling: true });
    console.log("DB INITIALISED");
    db.enablePersistence() //HERE IS THE PROBLEM
        .catch((err) => {
            if (err.code == 'failed-precondition') {
                // Multiple tabs open, persistence can only be enabled
                // in one tab at a a time.
                // ...
            } else if (err.code == 'unimplemented') {
                // The current browser does not support all of the
                // features required to enable persistence
                // ...
            }
      })
  };.....

The API Keys look like this:

const firebaseConfig = {
    apiKey: "***",
    authDomain: "***",
    databaseURL: "https://***",
    projectId: "***",
    storageBucket: "***",
    messagingSenderId: "***",
    appId: "***",
    measurementId: "***"
  };

  export default firebaseConfig;

I receive the following error which I can not work around:

FirebaseError: You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.

I have installed the complete "firebase" bundle and also access to @firebase/firestore, I checked this already, and I implemented it same as in the official docs. Everything works but when I want to enable the persistence... It crashes with the error mentioned above.

What can I do now? Do I miss another package, have I done something wrong?

As a sidenote, authentification persistence works perfectly inside my app, just the firestore persistence is failing.

Currently using firebase SDK 8.2.3

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have developed my app with Expo and was pointed to expo-firestore-offline-persistence. I notice on their page they talk about react-native-firebase for enabling persistence on RN - though that seems to require ejecting from Expo.

It seems this is an issue with polyfill on the RN platform. In other words, the Javascript that Firestore requires doesn't have everything necessary on the React Native platform - something that common browsers will have. So the "fix" is to leverage a component like react-native-firebase or expo-firestore-offline-persistence that give you that extra capability on native.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda