databaseURL not found in Firestore SDK snippet

Viewed 5216

I made a cloud firestore with Google Analytics enabled and I didn't find the databaseURL attribute in Firestore SDK snippet

Here's the CDN:

<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.2.1/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.2.1/firebase-analytics.js"></script>

<script>
  // Your web app's Firebase configuration
  // For Firebase JS SDK v7.20.0 and later, measurementId is optional
  var firebaseConfig = {
    apiKey: "AIzaSyAx5I8j6ZkqCxQ3k1UgGkL5BuwhVK5xezA",
    authDomain: "ninja-firestore-tut-c5340.firebaseapp.com",
    projectId: "ninja-firestore-tut-c5340",
    storageBucket: "ninja-firestore-tut-c5340.appspot.com",
    messagingSenderId: "326083693415",
    appId: "1:326083693415:web:5a8e21d6a0d90fec9d7dc2",
    measurementId: "G-2D61GV0P3Q"
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
  firebase.analytics();
</script>
2 Answers

The databaseURL property is for the Firebase Realtime Database, which you probably didn't create yet. The databaseURL property is not necessary to use Firestore though, so you should be able to access that with just the configuration data you have. In fact, for Firestore all you should need is the projectId property.

Your databaseURL should look like this:

https://<DATABASE_NAME>.firebaseio.com

Here's where you can find the name of your project's firestore database:

enter image description here

Related