Firebase实时数据库警告通过React Native Expo

huangapple go评论63阅读模式
英文:

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 复制的

Firebase实时数据库警告通过React Native Expo

英文:

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.

Firebase实时数据库警告通过React Native Expo

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

Firebase实时数据库警告通过React Native Expo

答案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",
   // ...
};

huangapple
  • 本文由 发表于 2023年2月6日 18:04:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359848.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定