The "database/not-found" error occurs when your Firebase Realtime Database configuration is missing, incorrect, or points to a non-existent database. Fix it by ensuring your databaseURL is properly configured in your Firebase initialization code.
The "database/not-found" error is thrown when your application cannot locate or connect to the Firebase Realtime Database instance. This typically happens when the database URL is missing from your Firebase configuration, incorrectly formatted, or points to a database that does not exist in your Firebase project. Unlike Firestore (which is included by default), Realtime Database requires an explicit URL to be configured. Firebase cannot automatically determine which database instance you want to use, especially if your project has multiple databases or databases in different regions.
Log into your Firebase Console, navigate to "Realtime Database", and find your database instance. Copy the full database URL (it will appear at the top of the database tab). It should look like:
- https://YOUR_PROJECT_ID.firebaseio.com (for us-central1)
- https://YOUR_PROJECT_ID.REGION.firebasedatabase.app (for other regions like europe-west1, asia-southeast1)
Update your Firebase initialization to include the databaseURL. In a web/JavaScript app:
const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "your-project.firebaseapp.com",
projectId: "your-project",
storageBucket: "your-project.appspot.com",
messagingSenderId: "YOUR_SENDER_ID",
appId: "YOUR_APP_ID",
databaseURL: "https://your-project.firebaseio.com" // Add this line
};
firebase.initializeApp(firebaseConfig);If your database is in a region other than us-central1, ensure you use the correct URL format with the region included:
// For Europe region
databaseURL: "https://my-db.europe-west1.firebasedatabase.app"
// For Asia Southeast region
databaseURL: "https://my-db.asia-southeast1.firebasedatabase.app"Do not use the old .firebaseio.com format for regional databases.
Ensure Firebase is fully initialized before calling any database methods. In a Node.js/Admin SDK context:
const admin = require("firebase-admin");
const serviceAccount = require("./serviceAccountKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://your-project.firebaseio.com"
});
const database = admin.database();
// Now database calls will workVisit your Firebase Console project settings and confirm that the Firebase Realtime Database is enabled. If you only see Firestore options or if the database is not created, click "Create database" in the Realtime Database section. Choose your preferred security rules and location.
Regional databases require special attention when migrating or using multiple database instances. If your project has multiple Realtime Database instances, each one will have a unique URL. You can create multiple database references by passing different URLs to getInstance() methods in your SDK. In React Native and Flutter, the database URL parameter is required even for the default us-central1 database. When deploying Firebase Functions, ensure your firebase.json includes the correct databaseURL in the functions configuration section.
messaging/UNSPECIFIED_ERROR: No additional information available
How to fix "messaging/UNSPECIFIED_ERROR: No additional information available" in Firebase Cloud Messaging
App Check: reCAPTCHA Score Too Low
App Check reCAPTCHA Score Too Low
storage/invalid-url: Invalid URL format for Cloud Storage reference
How to fix invalid URL format in Firebase Cloud Storage
auth/missing-uid: User ID identifier required
How to fix "auth/missing-uid: User ID identifier required" in Firebase
auth/invalid-argument: Invalid parameter passed to method
How to fix "auth/invalid-argument: Invalid parameter passed to method" in Firebase