[Solved] Can't find variable: IDBIndex on firebase/react native(expo)

React Native Faysal Shuvo

Problem: 

You are using firebase as a backend of your react native app and randomly started getting the error of -

 ReferenceError: Can't find variable: IDBIndex.

So this problem can be happening for multiple reasons. Here few of the solutions for you to try: 


Solution 1: 

If you are using firebase: “^9.6.8” downgrade it to firebase: “^9.6.7” to do that simply run: 

npm install firebase@9.6.7 

Downgrading will fix your problem.


Solution 2: 

Try to remember if you install or use npm instead of the expo to install a dependency. Sometimes this causes a syncing issue. so you can remove all lock files and node_modules, perform expo update and finally do yarn to reinstall all the packages.


Solution 3: 

This problem can also happen if you want to use analytics in firebase, but firebase only supports firestore & real-time database, authentication, and function on react native.to use analytics you can use expo-firebase-analytics. 

So, remove firebase.analytics()


Thank you for reading this article. Hope this solves the problem you are having. If not please comment below.