signUp on server-side not sending sendVerificationEmail()

Since the changes in v0.4.12 (though I’m not 100% sure), sendVerificationEmail() is no longer triggered automatically when I call auth.api.signUpEmail().

Next.js Server-Action:

    await auth.api.signUpEmail({
      body: {
        email,
        password,
        name,
        callbackURL: "/auth/login",
      },
      asResponse: true,
    });
...


auth.ts:

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: "postgresql",
  }),
...
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: true,
  },
  emailVerification: {
    sendOnSignup: true,
    sendVerificationEmail: async (user, url) => {
      console.log("Sending verification email to", user.email);
      await sendVerificationEmailNodemailer(user.email, url);
    },
  },
...


Yes, I can manually call sendVerificationEmail() in my server action but I don’t think that’s the intended way to handle this:

    await auth.api.sendVerificationEmail({
      body: { email, callbackURL: "/auth/login" },
      asResponse: true,
    });
Was this page helpful?