I'm having an issue with my signup user page where only half of it is functioning correctly.
What works: The createUserWithEmailAndPassword call via firebase firestore runs successfully.
What doesn't work: In the promise for that call, I'm trying to extract the uid from the user object and then create a corresponding user in the firestore database. However, when I try to use collection("users").set
, I'm getting an error stating that the default collection is not a function (See 'Console error" below.)
The error seems to be indicating that vue or firebase does not recognize
fb.collection('users').doc(res.user.uid).set...
as a valid function. I usually get this error when I forget to include a component, but in this case, I have already used fb.auth...
in the previous call.
Any assistance would be greatly appreciated!
...firebaseConfig
import firebase from 'firebase/app'
import 'firebase/firestore'
import 'firebase/auth'
const config = {
// REMOVED THE VALUES FOR SECURITY, but they are correct in the app
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: ""
}
firebase.initializeApp(config)
// firebase utils
const db = firebase.firestore()
const auth = firebase.auth()
const currentUser = auth.currentUser
// date issue fix according to firebase
const settings = {
timestampsInSnapshots: true
}
db.settings(settings)
export default {
db,
auth,
currentUser
}