ReferenceError: Can't find variable: IDBIndex when using Firebase on Expo - firebase

I'm developing an app using Expo, using the Firebase JS SDK (https://docs.expo.io/guides/using-firebase/), only for Authentication and to use the Cloud Firestore Database. It works fine on browser but when I switch to Expo Go I get this error:
ReferenceError: Can't find variable: IDBIndex
It's my understanding that the Firebase SDK should work fine aside from when using Analytics, which I'm not using. I have spent hours googling this issue but most people refer to an issue with Analytics, so any help would be really appreciated!
My package.json:
"dependencies": {
"#react-native-community/masked-view": "0.1.10",
"#react-navigation/native": "^5.9.4",
"#react-navigation/stack": "^5.14.4",
"expo": "~41.0.0",
"expo-status-bar": "~1.0.4",
"firebase": "8.2.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
"react-native-datefield": "^0.1.0",
"react-native-gesture-handler": "~1.10.2",
"react-native-reanimated": "~2.1.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.0.0",
"react-native-web": "~0.13.12"
},
"devDependencies": {
"#babel/core": "^7.9.0"
}

I fixed this issue by using firebase#9.1.0. In the expo docs they mention that they are using this version in their example. https://docs.expo.dev/guides/using-firebase/
With newer versions of Firebase I encounter the same issue.

Related

CocoaPods could not find compatible versions for pod "Firebase/CoreOnly": React native firebase

Upon trying to update my pods to the latest in order to work with IOS 12.0 I keep getting this error. I've seen this error pretty well documented online but none of the current solutions I have found seem to work.
In Podfile:
RNFBApp (from `../node_modules/#react-native-firebase/app`) was resolved to 10.5.0, which depends on
Firebase/CoreOnly (~> 7.4.0)
RNFBAuth (from `../node_modules/#react-native-firebase/auth`) was resolved to 10.5.1, which depends on
Firebase/Auth (~> 7.4.0) was resolved to 7.4.0, which depends on
Firebase/CoreOnly (= 7.4.0)
react-native-camera/BarcodeDetectorMLKit (from `../node_modules/react-native-camera`) was resolved to 3.42.0, which depends on
Firebase/MLVisionBarcodeModel was resolved to 5.0.0, which depends on
Firebase/CoreOnly (= 5.0.0)
As far as pod install --repo-update and pod update etc I keep returning to this error. I've updated my dependancies manually in the package.json file to the latest and removed the pod.lock file. I've run a react native clean across it to ensure all cache files are cleaned and tried to reinstalling everything and still getting the error.
I'm sure I'm missing something that I either need to wipe somewhere but can't find where exactly I need to do this.
Here's my Pod file
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.0'
target 'shoppinStore' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'shoppinStoreTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'shoppinStore-tvOS' do
# Pods for shoppinStore-tvOS
target 'shoppinStore-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
# add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
# add pods for any other desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'BarcodeDetectorMLKit'
]
And my Package.json
"name": "shoppinStore",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/checkbox": "^0.5.7",
"#react-native-community/geolocation": "^2.0.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-firebase/app": "^10.5.0",
"#react-native-firebase/auth": "^10.5.1",
"#react-native-firebase/firestore": "^10.5.1",
"#react-navigation/bottom-tabs": "^5.11.3",
"#react-navigation/native": "^5.9.0",
"#react-navigation/stack": "^5.13.0",
"firebase": "^8.2.3",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-camera": "^3.42.0",
"react-native-gesture-handler": "^1.9.0",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-navigation": "^4.4.3",
"react-redux": "^7.2.2",
"redux": "^4.0.5"
},
"devDependencies": {
"#babel/core": "^7.8.4",
"#babel/runtime": "^7.8.4",
"#react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^25.1.0",
"eslint": "^6.5.1",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
I'm pretty new to React Native, this all happened after chasing errors trying to connect my phone to test the app to get the React Native Camera library to work. Not the project won't build at all. Any pointers will be greatly appreciative.
I had this problem due to M1 chip.
I deleted Pods folder
Deleted PodFile.lock
For M1 chip :
1. Install ffi
sudo arch -x86_64 gem install ffi
2. Re-install dependencies
arch -x86_64 pod install
I was getting this also so I updated my firebase packages in package.json, deleted podfile.lock in the ios folder, and ran pod repo update, then pod install.
Worked after that! Good luck!

Unable to install firebase in expo

I using expo 3.27.10 and node v12.18.4 below is package info I tried to install firebase using expo and npm both fails then how I initialize firebase config file
firebase.initializeApp(firebaseConfig);
firebase.analytics();
and package.json is
"dependencies": {
"#react-native-community/masked-view": "0.1.10",
"#react-native-firebase/analytics": "^7.6.4",
"#react-native-firebase/app": "^8.4.3",
"#react-native-firebase/auth": "^9.2.3",
"#react-navigation/native": "^5.7.4",
"#react-navigation/stack": "^5.9.1",
"expo": "~39.0.2",
"expo-status-bar": "~1.0.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz",
"react-native-gesture-handler": "~1.7.0",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.1.4",
"react-native-screens": "~2.10.1",
"react-native-web": "~0.13.12",
"firebase": "7.9.0"
},
For me I have to change node version current 14.13 to LTS 12.18 and this allows me to install firebase
If: expo install firebase
isn't work for you and you got an Error,
That maybe you are having an old npm version uou need to update your npm
npm update
Or you got error for installation that because FIREBASE made update so to fix it use
yarn add firebase
see more: https://www.npmjs.com/package/firebase
I had a similar issue. What I did:
- remove firebase from the package.json.
- npm update
- npm install
- npm install --save firebase
afterwards had to change import * as firebase from 'firebase' to
import firebase from 'firebase'
if(firebase.apps.length === 0){
firebase.initializeApp(firebaseConfig)
}
p.s: working with VSCode, node v14.15.1, firebase 8.2.7
Downloading 2019 visual studio tools solved the error for me. You can scroll down and download only 2019 tools if you don't Want Visual Studio.
Click the link to download here

Cannot deploy Firebase Cloud Functions [Cannot find module 'protobufjs/minimal']

This error happened after I update firebase-functions and firebase-admin
"firebase-functions": "^2.0.4",
"firebase-admin": "^6.0.0"
Full Error
Error: Error occurred while parsing your function triggers.
Error: Failed to import the Cloud Firestore client library for Node.js. Make sure to install the "#google-cloud/firestore" npm package. Original error: Error: Cannot find module 'protobufjs/minimal'
This is all dependencies I have
"axios": "^0.18.0",
"compose-middleware": "^4.0.0",
"cors": "^2.8.4",
"cuid": "^1.3.8",
"exponent-server-sdk": "^2.3.1",
"express": "^4.15.4",
"firebase": "^4.13.1",
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.4",
"lodash": "^4.17.4",
"moment": "^2.22.2",
"query-string": "^6.1.0"
Maybe roll back to v5/v1? All you should need is below for cloud functions and firestore interactions.
var admin = require('firebase-admin');
var functions = require('firebase-functions');
Below is what my package.json shows, and my stuff works fine:
"firebase-admin": "^5.12.0",
"firebase-functions": "^1.0.2",
how about installing the missing protobufjs package with npm install or npm update ... maybe even explicitly add "protobufjs": "^6.8.8" - or install it with npm install protobufjs?

GraphiQL subscriptions working with subscriptions-transport-ws 0.7.3, but not 0.8.2

I have a nodejs GraphQL app running with the following
"graphql": "^0.10.5",
"graphql-errors": "^2.1.0",
"graphql-server-core": "^1.1.0",
"graphql-server-express": "^1.1.0",
"graphql-server-module-graphiql": "^1.1.0",
"graphql-subscriptions": "^0.4.4",
"graphql-tools": "^1.2.1",
"subscriptions-transport-ws": "^0.7.3",
Using this configuration, I can define a subscription in graphiql and watch the result appear in the output pane replacing the boilerplate message "Your subscription data will appear here after server publication!".
If I switch to the latest version of susbcriptions-transport-ws i.e.
"subscriptions-transport-ws": "^0.8.2",
this no longer works; the boilerplate message does not appear in the output pane and instead I get the cryptic [object] [object] message.
I've not been able to find any statement about version compatibility between graphiql and subscriptions-transport-ws; does anyone know if this version mix is supported?
I resolved the [Object Object] error in graphiql by reverting to these versions of following libraries in package.json:
"graphql-subscriptions": "^0.4.3",
"graphql-tools": "^1.0.0",
"subscriptions-transport-ws": "0.7.3",

React-Native-Meteor update React-Native 0.33

I'm running a Meteor server and a React-Native client (working in iOS mainly for now). Since I updated to React-native 0.33 the MeteorListView Component throws the following error:
My 'UserDos' follows the example of InProgress-team/react-native-meteor. When replacing the MeteorListView with a regular ListView everything works fine. Is anyone experiences this issue or can pinpoint/direct me to solving the issue?
Version
"react": "^15.3.1",
"react-native": "^0.33.0",
"react-native-lock": "^0.4.0",
"react-native-meteor": "^1.0.0-rc15",
"react-native-scrollable-tab-view": "^0.6.0",
"react-redux": "^4.4.5",
"redux": "^3.6.0",
"redux-thunk": "^2.1.0",
Fixed by reinstalling macOS and fresh install of React-native and dependances. Bit extreme solution but probably some complications with development version and upgrades; did the trick though!

Resources