Request resend verification email got 400 with Invalidation Error

I'm trying to resend verification email following the document guide in a Next.JS app:
   export function ResendEmail({ locale, email }: { locale: Locale, email: string }) {
    const { t } = useTranslation(locale);
    const handleResendEmail = async () => {
        // const response = await fetch('/api/register/email/resend', {
        //     method: 'POST',
        //     body: JSON.stringify({ email }),
        // });
        // if (response.ok) {
        //     console.log('Email sent successfully');
        // } else {
        //     console.error('Failed to send email');
        // }
        const callbackURL = "/"
        const { data, error } = await authClient.sendVerificationEmail({
            email,
            callbackURL
        });
        if (error) {
            console.error(error);
        }
        if (data) {
            console.log(data);
        }
    }

    return (
        <Button className="w-full" variant="outline" onClick={handleResendEmail}>
            {t('pages.emailConfirmation.resendEmail')}
        </Button>
    )
}

But I got 400 response from the /api/auth/send-verification-email api says:
{"code":"VALIDATION_ERROR","message":"Invalid body parameters"}

As you may found I've also tried using a custom API endpoint to use server method sending the veirication email but no luck.

Did I miss something?

Many thanks in advance for everyone in this lovely community 🙂
Was this page helpful?