Match failed in loginWithPassword()


#1

Hi,
I’m using accounts-password with email (instead of username). Very few users are getting an error logging in, so I’m finding it difficult to identify the issue. They are getting a “match failed”:

 Exception while invoking method 'login' Error: Match error: Match error: Failed Match.Where validation in field username in field user.username
   at check (packages/check/match.js:35:15)
   at MethodInvocation.<anonymous> (packages/accounts-password/password_server.js:266:3)

I am calling loginWithPasword using an email and the password, so not sure why it’s trying to match username.

I modified the call to loginWithPasswor to be loginWithPassword({email: …}, ) so that it would be explicitly using it with email, and I still get a match error, but now on email:

Exception while invoking method 'login' Error: Match error: Match error: Failed Match.Where validation in field email in field user.email
     at check (packages/check/match.js:35:15)
     at MethodInvocation.<anonymous> (packages/accounts-password/password_server.js:266:3)

I am certain that this is not an issue with the email or password being entered incorrectly.

Any help would be greatly apprciated - I haven’t found any other record of this issue…


#2

revisaste la base de datos que crea la función loginWithPassword?
" db.users.find()"


#3

Yes, I checked the documents in the database, and the one for a user with issues looks normal. I even used it to create an account with the same email address on a different instance to see if there was something weird in that email address…


#4

Did you find the answer to this? I see it quite often in my log files, but hard to catch since the error occurs inside Accounts package and I cannot trap that error


#5

Seems like that error is simply thrown if called with username undefined or “”


#6

Yes - I think I tracked it down to the same issue as you identified, but I can’t be 100% sure. I now explicitly catch an empty username or password before this method gets called and I am not seeing the error in the logs anymore.