Angular: 2.1.0
Firebase: 3.x
AngularFire: 2.0.0-beta.6
Steps to set up and reproduce
.catch(
err => {
console.log('error:', err);
let error = err;
console.log('error code:', error.code);
console.log('error message:', error.message);
if(error.code === "auth/user-not-found") {
console.log("User not found");
}
}
)
login.component.ts:65:17 Property 'code' does not exist on type 'Error'.
error: R {code: "auth/user-not-found", message: "There is no user record corresponding to this identifier. The user may have been deleted."}
login.component.ts:10 error code: auth/user-not-found
login.component.ts:11 error message: There is no user record corresponding to this identifier. The user may have been deleted.
login.component.ts:13 User not found
Expected to have Property 'code' on type 'Error'. So I can check for certain errors and display a corresponding message to the user. For example:
if(error.code === "auth/user-not-found") {
console.log("User not found");
}
Property 'code' does not exist on type 'Error'.
If you encounter the same problem and want a temporary fix you can use :any on the error object.
let error: any = err;
I feel like the error class needs extended, this is everything that comes out

It seems to be missing credential, which is very important when linking accounts.
@frankspin89 Which AngularFire API does this apply to?
@jeffbcross Calling the AngularFireAuth api with the login method. (Login with email, and password).
Thought I would write this just to help anyone that comes across this while it is not fixed and to make sure the devs have as much info as possible. As above I have same issue with the AngularFire.auth.login() method when using the E-Mail and Password authentication method as mentioned earlier
Example
this.af.auth.login({
email: this.userEmail,
password: this.userPassword
}).catch(error => {
console.log(error);
// Show failed login validation
this.loginFailed = true;
});
Error is not of the right type
This is the type that AngularFire thinks the error is going to be:

This is the object that gets logged to the console from the above snippet
Error:{
code:"auth/user-not-found",
message: "There is no user record corresponding to this identifier. The user may have been deleted."
}
I cannot work out what sort of error the user is getting when they try to log in. I can't have any conditional behaviour to improve the UX of my project based off of the error that is returned. (i.e Displaying the register page if no user is found, giving detailed error feedback to the user if for example their token expires )
My Workaround for anyone dealing with this is to use the bracket notation with string literals. Which is a shitty implementation and should only be used temporarily. There is no compile time checking and the reliability of my application working is directly dependent on my ability to remember and spell the properties on the object.
See an example below
this.af.auth.login({
email: this.userEmail,
password: this.userPassword
}).catch(error => {
// Returns the firebase Error Code documented here https://firebase.google.com/docs/reference/js/firebase.auth.Error
console.log(error['code']);
// Returns the fire base message associated with the Error Code
console.log(error['message']);
// Show failed login validation
this.loginFailed = true;
});
Hope this helps !
Solved this by defining link as: [routerLink]="['/register'] instead of anything else.
Most helpful comment
Thought I would write this just to help anyone that comes across this while it is not fixed and to make sure the devs have as much info as possible. As above I have same issue with the AngularFire.auth.login() method when using the E-Mail and Password authentication method as mentioned earlier
Example
Error is not of the right type
This is the type that AngularFire thinks the error is going to be:
This is the object that gets logged to the console from the above snippet
Error:{ code:"auth/user-not-found", message: "There is no user record corresponding to this identifier. The user may have been deleted." }I cannot work out what sort of error the user is getting when they try to log in. I can't have any conditional behaviour to improve the UX of my project based off of the error that is returned. (i.e Displaying the register page if no user is found, giving detailed error feedback to the user if for example their token expires )
My Workaround for anyone dealing with this is to use the bracket notation with string literals. Which is a shitty implementation and should only be used temporarily. There is no compile time checking and the reliability of my application working is directly dependent on my ability to remember and spell the properties on the object.
See an example below
Hope this helps !