Account.onCreateUser() firing even when user is already existant

I’ve hit a weird case where I see that Account.onCreateUser() is being called during sign-up even if the email address is already in use and the account isn’t actually being created.
Is this desired behavior?

Yes - the onCreateUser hook is always called before a user insert is attempted. When the insert is attempted it throws an exception if the email already exists, but at this point the onCreateUser hook has already been called. See https://github.com/meteor/meteor/blob/devel/packages/accounts-base/accounts_server.js#L1229-L1255.

Ok, it doesn’t make much sense but that’s fine. I’ll just intercept it during validateNewUser() like detailed here then: http://docs.meteor.com/#/full/accounts_validatenewuser

Thanks!