Error in sendPasswordResetEmail - Firebase

I am trying to send a reset password link using firebase in ionic application…but when i do this…it shows the following error
Error Message: Object { code: “auth/internal-error”, message: "{“error”:{“errors”:[{“domain”:“glob…”, stack: “” }
The code is below

async resetPassword(user:User){     
    const reset = await this.afauth.auth.sendPasswordResetEmail(user.email)
    .then(function(reset){ 
              if(reset){ 
                  this.navCtrl.push(ResetPage);     
                           this.toast.create({  
                                 'message':"Password reset email has been sent to your mail",          
                                  duration:5000,   
                            }).present();
             }else{ 
              console.log('Error while sending Reset link email'); 
       } 
      },function(error){  
         console.log("Error Message:",error);
       });
  }

it directly gets into else part…but when i tried to print the user email id its printing the user email id in console…like i did

let email = user.email;
console.log(email);

Anyhelp thanks…

Don’t ever type the word “function” inside of one. Always use arrow functions or lambdas.

just now i edited my post…see the post.now i bolded the text which the actual error was…:slight_smile:

You’re using async/await with non-lexical functions containing this, which is a breeding ground for nondeterministic bugs.

I recommend you ditch async//await, and instead handle the Promise returned by af as a Promise, with resolve and reject arrow functions.