title: getInstance() doesn't work with other location than us-central1 in Realtime Database
body: <p>I am trying to save user credentials to Firebase Realtime Database. However, when I execute the program, the DB does not update. I have configured the Firebase setup correctly as Authentication and Storage (both Firebase) are working.</p>
  <p><code>build.gradle</code>:</p>
  <pre><code>dependencies {
      ...
      // Firebase SDK setup
      // Import the BoM for the Firebase platform
      implementation platform('com.google.firebase:firebase-bom:28.0.1')
  
      // Declare the dependency for the Firebase library
      implementation 'com.google.firebase:firebase-storage-ktx'
      implementation 'com.google.firebase:firebase-auth-ktx'
      implementation 'com.google.firebase:firebase-database-ktx'
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  <p><code>AndroidManifest.xml</code>:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; package=&lt;NAME&gt;&gt;
  
      &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
  
      &lt;application
        ...
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  <p>The registration class (MWE):</p>
  <pre><code>class RegisterActivity : AppCompatActivity() {
  
      var selectedPhotoUri: Uri? = null
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          // Register UI
          register_button_register.setOnClickListener {
              performRegister()
          }
      }
  
      // Register user credentials
      private fun performRegister() {
          val email = email_editText_register.text.toString()
          val password = password_editText_register.text.toString()
  
          // Firebase Authentication - WORKING
          FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, password)
              .addOnCompleteListener {
                  uploadImageToFirebaseStorage()
              }
      }
  
      // Upload selected photo to Firebase Storage - WORKING
      private fun uploadImageToFirebaseStorage() {
          if(selectedPhotoUri == null)    return
  
          val filename = UUID.randomUUID().toString()
          val ref = FirebaseStorage.getInstance().getReference(&quot;/images/$filename&quot;)
  
          ref.putFile(selectedPhotoUri!!)
  
          ref.downloadUrl.addOnSuccessListener {
              saveUserToFirebaseDatabase(it.toString())
          }
      }
  
      // Save user associated credentials to Firebase Database - NOT WORKING
      private fun saveUserToFirebaseDatabase(profileImageURL: String) {
          val uid = FirebaseAuth.getInstance().uid ?: &quot;&quot;
          val ref = Firebase.database.getReference(&quot;/users/$uid&quot;)
          val user = User(uid, username_editText_register.text.toString(), profileImageURL)
  
          ref.setValue(user)
      }
  }
  
  // User credentials to be saved
  class User(val uid: String, val username: String, val profileImageURL: String)
  </code></pre>
  <p>The <code>saveUserToFirebaseDatabase()</code> method does not get executed? I have checked <code>logcat</code> after inserting <code>onSuccessListener</code> and <code>onFailureListener</code> statements, however no error or debug information is highlighted. The app. pushes the image to storage but the DB is not updated. It remains empty. The workflow is as:</p>
  <pre><code>- Authenticate user by email and password. - WORKING
  - Save profile image in Storage. - WORKING
  - Save profile identifier, username, and image in DB. - NOT WORKING
  </code></pre>
  <p>Firebase DB rules:</p>
  <pre><code>{
    &quot;rules&quot;: {
      &quot;.read&quot;: &quot;true&quot;,
      &quot;.write&quot;: &quot;true&quot;
    }
  }
  </code></pre>
  <p>I tried changing the hierarchy but that did not work either:</p>
  <pre><code>val uid = FirebaseAuth.getInstance().uid ?: &quot;&quot;
  val ref = Firebase.database.getReference(&quot;/users/$uid&quot;)
  val user = User(uid, username_edittext_register.text.toString(), profileImageUrl)
     
  ref.child(&quot;users&quot;).child(uid).setValue(user)
  </code></pre>
  <p>I have read the Firebase documentation and everything seems to be in place. I also disabled my firewall but that did not work either. Can someone point out the problem here? Thank you in advance.</p>