Firebase wants me to change my database url due to region

Viewed 6624

The error message is as below:

Reason: Database lives in a different region. Please change your database URL to Same URL as my database indicates.

While I'm trying to import some data on my Realtime DataBase of Firebase, This error keep showing. Which indicates that I need to change the URL of database because database is in another region.

The url that the app wants me to change is the same as the url of my database. So there seems to be no problem.

So do I need to change the url of database programmatically? If so how can I do that?

Thanks.

1 Answers

You just need to manually add the database URL in the ref.

For a us-central1 default database, you can call database() (or database) without argument. To get a reference to a database other than a us-central1 default database, you must pass the database URL to database()

let ref = Database.database("https://<databaseName><region>.firebasedatabase.app")

You can read more about Relatime Database Locations here.

enter image description here

The database URL of new database is shown while creating it as well (although the default URL is added in the Config).

enter image description here

Related