I'm using Expo SDK for my ios app, when I try to write data in the firebase database but I'm getting the error. Error: FIREBASE FATAL ERROR: Cannot parse Firebase URL. Please use https://.firebaseio.com*
My firebase config file is
const firebaseConfig = {
apiKey: "xxxxxx",
authDomain: "xxxxxx.firebaseapp.com",
databaseURL: "https://xxxxxxxxxxxxxx.europe-west1.firebasedatabase.app",
projectId: "xxxxx",
storageBucket: "xxxxxxx.appspot.com",
messagingSenderId: "xxxxxxxxx",
appId: "xxxxxxxxxx",
measurementId: "xxxxxx"
};
my function that stores the data is
signUp = () => {
const user = firebase.auth().currentUser;
let userid = user.uid;
firebase
.database()
.ref(`users/${userid}`)
.set({
firstname: this.state.firstname,
lastname: this.state.lastname,
password: this.state.password,
email: this.state.email,
dob: this.state.dob,
postcode: this.state.postcode,
})
.then(() => {
alert("user created");
})
.catch((err) => {
alert("error");
});
};
My database rules are set to true for reading and write.
I have tried the following database URL but none of them work.
const firebaseConfig = {
databaseURL: "https://xxxxxxxxxxxxxx.europe-west1.firebaseio.com",
};
const firebaseConfig = {
databaseURL: "https://xxxxxxxxxxxxxx.firebaseio.com",
};
Looking for help, please
firebase.database().ref("https://<DATABASE_NAME>.firebasedatabase.app")
as a workaround either way. – Frank van Puffelen