_firebase_config__WEBPACK_IMPORTED_MODULE_3__.default.createUserWithEmailAndPassword is not a function in Vue Js

Shivam

createUserWithEmailAndPassword function is not working for me. Below are my code -

config.js

import firebase  from 'firebase/app'
import 'firebase/firestore'
import 'firebase/auth'

const firebaseConfig = {
    apiKey: "AIzaSyBD8W5T7ZSvryW2TNSWOgoCO3EpyV6i65o",
    authDomain: "vue-firebase-site-eb79e.firebaseapp.com",
    projectId: "vue-firebase-site-eb79e",
    storageBucket: "vue-firebase-site-eb79e.appspot.com",
    messagingSenderId: "657936011344",
    appId: "1:657936011344:web:a2498d2fe27f951b6b8155"
  };


firebase.initializeApp(firebaseConfig)

const projectAuth = firebase.auth();
const projectFirestore = firebase.firestore();
const timeStamp = firebase.firestore.FieldValue.serverTimestamp

export default { projectAuth, projectFirestore, timeStamp }

useSignUp.js

import { ref } from "vue"
import projectAuth from '../firebase/config'

const  error = ref(null)

const signup = async (email,password,displayName) => {
    error.value  =  null

    try {
        const res = await projectAuth.createUserWithEmailAndPassword(email, password)
        console.log(res)
        if(!res){
            throw new Error('Could not complete the signup')
        }
        await res.user.updateProfile({displayName})
        error.value = null
        return res
    } catch (err) {
        console.log(err.message)
        error.value = err.message
    }
}

const useSignup = () =>{

    return{error, signup}
}

export default useSignup

Tried a number of things-

  1. Delete node modules and install them again.
  2. Change the version of firebase as well

Nothing working for me any solutions are appreciated.

Thanks in Advance!!

Hello World

when you importing the config.js file inside useSignUp.js you are setting the whole object as projectAuth

what you need to do is following:

import { projectAuth } from '../firebase/config' // just get projectAuth variable from config.js

edit:

There is another way to work this around:

import firebaseConfig from '../firebase/config' 

then inside the try block use this:

const res = await firebaseConfig.projectAuth.createUserWithEmailAndPassword(email, password)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Firebase 3.3.x Nodejs - createUserWithEmailAndPassword is not a function

Firebase & Captcha for createUserWithEmailAndPassword

Vue.js - Uncaught (in promise) TypeError: __WEBPACK_IMPORTED_MODULE_0__services_Api__.a.post is not a function

TypeError: __WEBPACK_IMPORTED_MODULE_0_react___default.a.createRef is not a function

Firebase - TypeError: admin.auth(...).createUserWithEmailAndPassword is not a function

Vue: default value for prop function

TypeError: _firebase_firebase__WEBPACK_IMPORTED_MODULE_8__.default.auth is not a function

TypeError: _firebase_firebase_utils_js__WEBPACK_IMPORTED_MODULE_7__.auth.onAuthStateChange is not a function

Uncaught type error when trying to install keycloak-js with vue and webpack: __WEBPACK_IMPORTED_MODULE_3_keycloak_js__ is not a function

recoil__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function

Which is safer - using Firebase auth.createUserWithEmailAndPassword() or using a cloud function?

Firebase createUserWithEmailAndPassword method is undefined in node.js

createUserWithEmailAndPassword with AngularFireAuth and firebase

TypeError: react__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function

TypeError: _firebase__WEBPACK_IMPORTED_MODULE_3__.default.auth is not a function login from authentication with firebase/react

"TypeError: chart_js__WEBPACK_IMPORTED_MODULE_9__.default is not a constructor"

calling a function in Vue.js 3 at <template>

TypeError: _firebase__WEBPACK_IMPORTED_MODULE_2__.default.collection is not a function

TypeError: _fire__WEBPACK_IMPORTED_MODULE_1__.default.auth is not a function

Uncaught (in promise): TypeError: firebase_compat_app__WEBPACK_IMPORTED_MODULE_1__.default.storage is not a function

TypeError: firebase_compat_app__WEBPACK_IMPORTED_MODULE_0__.default.firestore is not a function

TypeError: firebase_compat_app__WEBPACK_IMPORTED_MODULE_4__.default.auth is not a function

Next JS firebase TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_1__.storage is not a function

Uncaught TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_0__.firestore is not a function in Vue js

Firebase function createUserWithEmailAndPassword is not being called within my custom function

React/Firebase error "Uncaught (in promise) TypeError: (0 , _firebase__WEBPACK_IMPORTED_MODULE_1__.default) is not a function"

TypeError: _firebase_config__WEBPACK_IMPORTED_MODULE_2__.default.auth is not a function

The following error message appears. "Uncaught TypeError: vue_filepond__WEBPACK_IMPORTED_MODULE_1___default(...).default is not a function."

TypeError: _firebase__WEBPACK_IMPORTED_MODULE_1__.default.collection is not a function

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive