tylermcginnis/re-base

databaseURL error

neil-mills opened this issue · 7 comments

When i run this code i get

database.js:52 Uncaught Error: FIREBASE FATAL ERROR: Can't determine Firebase Database URL. Be sure to include databaseURL option when calling firebase.intializeApp().

even though databaseURL is included in the config

@neil-mills that error message is from the firebase SDK and only happens if the key databaseURL doesn't exist in the config option you pass. can you post your call to firebase.initializeApp() ?

I'm having the same problem as Neil.

My firebase config has:

import * as firebase from 'firebase';

// Initalize and export Firebase.
const config = {
  apiKey: process.env.FIREBASE_API_KEY,
  authDomain: process.env.FIREBASE_AUTH_DOMAIN,
  databaseURL: process.env.FIREBASE_DB_URL,
  projectId: process.env.FIREBASE_PROJECT_ID,
  storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
  messagingSenderId: process.env.FIREBASE_MESSAGE_ID
};

if (!firebase.apps.length) {
  firebase.initializeApp(config);
};

const database = firebase.database();

const auth = firebase.auth();

export {firebase, auth, database };

Did you find a solution?

@MincePie how are you setting the process.env variables? Check what the config variable looks like if you console.log it before passing to firebase.initializeApp

@MincePie No that should do it I think if the config object is correct. If you log that config variable before passing to firebase.initalizeApp you can see the databaseURL property and it is set with the correct value?

having the same issue- when console logging the config, getting all my values undefined

{apiKey: undefined, authDomain: undefined, databaseURL: undefined, projectId: undefined, storageBucket: undefined, …}
i have my .env.dev file set up and i used the dotenv module.
@qwales1

I don't think this is related to something happening in re-base so going to close but from testing this error
Uncaught Error: FIREBASE FATAL ERROR: Can't determine Firebase Database URL. happens if the key databaseURL doesn't exist in the config object. If it exists and its undefined or null it would be a different error message.