I am currently following a tutorial on Vue.js from Savvy Apps, which utilizes Firebase with Firestore. As the tutorial mentions that Firestore is still in Beta, I anticipate potential changes - and it seems like that might be happening in this case.
While attempting to sign up a new user by filling out the form and clicking 'Sign up', I encountered the following error message:
Error: Function CollectionReference.doc() requires its first argument to be of type string, but it was: undefined
Interestingly, upon checking Firebase, I noticed that the user had indeed been created. So why am I getting this error message? What exactly should the first argument be?
The signup code snippet looks something like this:
signup() {
this.performingRequest = true;
fb.auth.createUserWithEmailAndPassword(this.signupForm.email, this.signupForm.password).then(user => {
this.$store.commit('setCurrentUser', user);
// create user obj
fb.usersCollection.doc(user.uid).set({
name: this.signupForm.name,
title: this.signupForm.title
}).then(() => {
this.$store.dispatch('fetchUserProfile');
this.performingRequest = false;
this.$router.push('/dashboard')
}).catch(err => {
console.log(err);
this.performingRequest = false;
this.errorMsg = err.message
})
}).catch(err => {
console.log(err);
this.performingRequest = false;
this.errorMsg = err.message
})
},
Feel free to request additional code if necessary - this is my initial experience testing Vue.js.