So I got this issue while following a tutorial on how to set Authentication on a Firebase + Vue project here https://www.youtube.com/watch?v=XtbYBoKb2zY
On the section about setting up the register page.
ERROR
Setting up the Register page as Following is giving me an error.
1
2
3
4
5
6
7
8
9
10
11
12
13
export default {
methods: {
async pressed(){
try {
const user = firebase.auth().createUserWithEmailAndPassword(this.email)
console.log(user)
this.$router.replace({name: "secret"})
}
catch(err){
console.log(err)
}
}
},
1
2
3
4
5
6
7
8
9
10
11
12
13
# ERROR
TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_4__.auth is not a function
at _callee$ (Register.vue?0103:24)
at tryCatch (runtime.js?96cf:63)
at Generator.invoke [as _invoke] (runtime.js?96cf:293)
at Generator.eval [as next] (runtime.js?96cf:118)
at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
at _next (asyncToGenerator.js?1da1:25)
at eval (asyncToGenerator.js?1da1:32)
at new Promise (<anonymous>)
at eval (asyncToGenerator.js?1da1:21)
at VueComponent.pressed (Register.vue?0103:22)
The issue was actually in my main.js where I had
1
import firebase from "firebase/app"
I changed this to
1
import firebase from "firebase/app"
and it worked. :)