英文:
Firebase realtime database warning via react native expo
问题
我刚刚手动输入了所有数据到我的 Firebase 实时数据库。但是当我运行我的应用程序(使用 React Native Expo)时,在我的终端中出现了以下警告:
[2023-02-06T09:53:41.782Z] @firebase/database: FIREBASE WARNING: Database lives in a different region. Please change your database URL to https://******-default-rtdb.asia-southeast1.firebasedatabase.app (https://*******-default-rtdb.firebaseio.com/)
这是什么意思?这意味着我的 Firebase 实时数据库完全无法工作吗?
另外,我检查了我的 Firebase 实时数据库 URL,URL 与括号中要求我更改为的 URL 相同。这是什么意思?我对此感到困惑。
如果我必须将 URL 更改为括号中的 URL,我该如何操作?
我的当前 Firebase 配置:我在开始开发这个应用程序时从 Firebase 复制的
英文:
I have just manually key in all the data in my firebase realtime database. But when i run my application (using react native expo), i get the following warning in my terminal:
[2023-02-06T09:53:41.782Z] @firebase/database: FIREBASE WARNING: Database lives in a different region. Please change your database URL to https://******-default-rtdb.asia-southeast1.firebasedatabase.app (https://*******-default-rtdb.firebaseio.com/)
What does this means? Does it means my firebase realtime database wont work at all?
Also I did a checked on my firebase realtime database URL, the url is the same as the one they ask me to change to before the URL in the bracket. What does this means? I am confused by this.
If I have to change the URL to the bracket one, how do i do it?
My current firebase config: I copied this from the firebase when I first started developing this app
答案1
得分: 2
根据您的评论和问题更新进行更新: 看起来您的 Firebase 配置对象不包含您的实时数据库实例的 URL。
您没有分享您的Firebase配置对象,但似乎它包含基于默认区域即us-central1
区域的实时数据库实例的URL。
因此,您需要使用正确的URL更新Firebase配置对象,对应于asia-southeast1
区域。
const firebaseConfig = {
apiKey: "API_KEY",
authDomain: "PROJECT_ID.firebaseapp.com",
// `databaseURL`的值取决于数据库的位置
databaseURL: "https://******-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "PROJECT_ID",
// ...
};
英文:
Update following your comment and question update: It appears that your Firebase config object doesn't contain the URL of your Realtime Database instance.
You didn't share your Firebase config object but it seems that it contains the URL of Realtime Database instance based in the default region, i.e. the us-central1
region.
So you need to update your Firebase config object with the correct URL, corresponding to the asia-southeast1
region.
const firebaseConfig = {
apiKey: "API_KEY",
authDomain: "PROJECT_ID.firebaseapp.com",
// The value of `databaseURL` depends on the location of the database
databaseURL: "https://******-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "PROJECT_ID",
// ...
};
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论