firebase "error": { "code": 400, "message": "QUOTA_EXCEEDED", "status": "INVALID_ARGUMENT" } with react redux

952 views Asked by At

hello i'm facing that error when i sign up or sign in with firebase auth and add some additional data in firestore

("error": {
    "code": 400,
    "message": "QUOTA_EXCEEDED",
    "status": "INVALID_ARGUMENT"
  }
)

i searched a lot but didn't find any solve here is my action code and it sometimes loged me out automatically .................................................................................................................................. and thank you

export const signUp = (cred) => {
    return  (dispatch,getState,{getFirebase,getFirestore}) => {
        const firebase = getFirebase()
        const firestore = getFirestore()
        const version =  localStorage.getItem("version")
        
        if(!version){
            dispatch({type:"FIELD_EMPTY",payload:{message:"You Must Choose A version"}})
        }else{
            firebase.createUser({email:cred.email,password:cred.password})
            .then(() => {
                return firestore.collection("users").doc(firebase.auth().currentUser.uid).set({
                    firstName:cred.firstName,
                    lastName:cred.lastName,
                    initials:`${cred.firstName[0]}${cred.lastName[0]}`,
                    version,
                    joinedAt: new Date()
                }) 
            })
            .then(() => {
                return firebase.auth().currentUser.sendEmailVerification()
            })
            .then(() => {
                dispatch({type:"SIGN_UP_SUCCESS"})
            })
            .catch((err) => {

                dispatch({type:"SIGN_UP_FAILED",payload:err})
            })
        }
    }
}
export const signIn = (cred) => {
    return (dispatch,getState,{getFirebase,getFirestore}) => {
        const firebase = getFirebase()
        firebase.login(cred)
            .then(user => {
                dispatch({type:"SIGN_IN"})
            })
            .catch(err => {
                dispatch({type:"SIGN_IN_FAILED",payload:err})
            }) 
    }
}
export const logOut = () => {
    return (dispatch,getState,{getFirebase}) => {
        const firebase = getFirebase()
        firebase.logout()
        .then(() => dispatch({type:"LOG_OUT"}))
        .catch((err) => dispatch({type:"LOG_OUT_ERR",payload:err}))
    }
}
0

There are 0 answers