开发者

React Native not connecting to Firebase Database

开发者 https://www.devze.com 2022-12-07 22:27 出处:网络
I\'ve been working with a React Native app that utilizes the Firebase Realtime database for several months now. Recently, the app refuses to connect to the database despite having made no changes to t

I've been working with a React Native app that utilizes the Firebase Realtime database for several months now. Recently, the app refuses to connect to the database despite having made no changes to the code. When I try to run database().ref("ref").on("value", ...), the function does not error but instead never resolves. Additionally, querying the .info/connected ref returns false.

Query function:

import database from "@react-native-firebase/database";

database().ref(".info/connected").on("value", v => console.log("connected", v.val()));
database().ref(`/v2/teams/${teamID}`).on("value", v => console.log("team", v.val()));

Package.json dependencies:

"dependencies": {
    "@react-native-firebase/analytics": "15.3.0",
    "@react-native-firebase/app": "15.3.0",
    "@react-native-firebase/auth": "9.2.1",
    "@react-n开发者_高级运维ative-firebase/database": "7.5.5",
    "@react-native-firebase/functions": "15.3.0",
    "react": "16.13.1",
    "react-native": "0.63.2",
}

I tried creating a blank test project following the instructions here, but that test project also failed to connect to my database. I also have a website which queries the same database which is perfectly fine, and there are no issues with database load or performance. I'm not receiving any errors of any kind so I'm somewhat lost as what to pursue.

0

精彩评论

暂无评论...
验证码 换一张
取 消