Skip to content

Client verifyEmail() always fails: '_system.user.verifyEmail' is not defined #421

Closed

Description

@poojagosika

What happens

verifyEmail({ token }) from modelence/client always rejects with:

Method with name '_system.user.verifyEmail' is not defined.

so the "Manual Verification" flow in docs/web/authentication/email-verification.mdx can't work.

Why

  • The client calls callMethod('_system.user.verifyEmail', { token }) (src/auth/client/index.ts).
  • The _system.user module (src/auth/user.ts) registers no verifyEmail mutation. Its mutations are signupWithPassword, loginWithPassword, logout, resendEmailVerification, sendResetPasswordToken, resetPassword, sendMagicLink, loginWithMagicLink, loginWithOneTimeCode, loginWithOAuth, updateProfile and unlinkOAuthProvider.
  • Email verification only exists as the GET route /api/_internal/auth/verify-email (handleVerifyEmail in src/auth/verification.ts), which is what the emailed link uses.

The client test (src/auth/client/index.test.ts, "verifyEmail calls backend method with token") only checks that callMethod receives that name, so the missing server method isn't caught.

Proposed fix

Option A, which I'd suggest: add a verifyEmail mutation to the _system.user module that reuses verifyEmailToken(token) from verification.ts and fires onAfterEmailVerification / onEmailVerificationError like the route does. Plus a test that every _system.user.* method the client calls is registered on the server.

Open question for A: should the mutation also create a session the way the GET route does? I'd leave that out and only verify the email, since the caller may not be the account owner's current browser.

Option B: remove or deprecate the client verifyEmail export and the "Manual Verification" docs section, if the emailed link is meant to be the only path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions