Closed narayanchoudhary closed 3 years ago
I am having the same issue. Same config as above. When i start my Expo app I get JSON Parse error: Unexpected identifier "object"
Sorry guys I'm not sure. This repo was just made public to help based on a GitHub convo I saw, as mentioned in the readme. Lmk if you figure it out
Maybe try importing fromfirebase/app
instead of firebase
I have exactly the same issue, same with firebase/app and I also tried to change 'firebase/firestore'; by 'firebase/firestore/memory'; as mentioned here but without success
Maybe try importing from
firebase/app
instead offirebase
I am importing from firebase/app
and it still doesn't work. Is there an Expo project without swr-firestore
you have tried this in that works? Maybe we could get some pointers from there
This code is from a while ago, and I'm no longer using firestore in my app's frontend unfortunately, so I'm not sure. The swr lib doesn't add anything special for persistence though, all it does is fetch firestore
Maybe try importing from
firebase/app
instead offirebase
I am importing from
firebase/app
and it still doesn't work. Is there an Expo project withoutswr-firestore
you have tried this in that works? Maybe we could get some pointers from there
I Confirm, I also tried without sw-firestore, same issue. I searching other options but expo-firestore-offline-persistence is often quoted
It does work with firestore@8.6.1 but for only an hour, the expo-compatible firebase version doesn't work.
However, I'm running into another issue. If I run the app offline after an hour or so, the app just crashes. I'm not able to figure out why. I'm not even able to catch it with Sentry, so not sure what's going on. I'm sure it has something to do with Firestore, looking at the logs from adb logcat, it crashes when Firestore is trying to get data from the offline cache. If only I could catch it then may be I could do something about it.
The error is : "a network error (such as timeout, interrupted connection or unreachable host) has occurred." The error shows up in development mode, but in production mode the app just crashes.
Hey guys, same guy who debugged to get IndexedDBShim working on Android for this to work here. I was having the same trouble as you guys ever since Firebase version 8.1.2 (with @firebase/firestore dependency 2.1.0), but never got around to looking into it.
Just wanted to say this was an issue with the Firebase-JS-SDK bundler which packaged the memory-only build as the default build for react native. This was finally fixed in Firestore release 8.2.7 (See commit here). So basically, installing any Firebase version from that and up should work. Currently I'm using Firebase 8.7.1 and it's functioning fine, so... so far so good!
Cheers.
Now that Expo allows any native libraries, I recommend just switching to react-native-firebase. @barthap made a great config plugin for it: https://github.com/barthap/with-rn-firebase
I recommend reading about @expo's new Config Plugin system in SDK 42.
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.
My Code:
import 'expo-firestore-offline-persistence'; import * as firebase from 'firebase'; import 'firebase/firestore';
const firebaseConfig = {.....};
if (!firebase.app.length) firebase.initializeApp(firebaseConfig);
let firestoreDB = firebase.firestore(); firestoreDB.enablePersistence();