Hey everyone! 👋
I'm currently facing an issue with the password recovery feature in my Appwrite-based application. I'm using Appwrite's built-in email solution to send password recovery emails, and everything works perfectly when I'm running the app on localhost. However, once I deploy the application to my live domain, the password recovery emails are not being sent.
Here's my current backend endpoint for initiating password recovery:
`.post(
"/forgot-password",
zValidator("json", z.object({ email: z.string().email() })),
async (c) => {
const { email } = c.req.valid("json");
const { account } = await createAdminClient();
try {
await account.createRecovery(
email,
`${APP_URL}/reset-password`
);
return c.json({ success: true });
} catch (error) {
console.error("Password recovery creation failed:", error);
return c.json({ error: "Failed to initiate password recovery" }, 400);
}
}
)`
When I input an email to recover the password on the live version, I see this error in the browser console:
POST https://my-app.com/api/auth/forgot-password 400 (Bad Request)
What I've Tried So Far:
The application works fine in localhost.
I've verified my domain by creating a CNAME record in my DNS for appwrite.my-app.com.
I've double-checked my API endpoint and Appwrite project configuration.
I've also added my production domain in Appwrite's Domain Whitelist.
Despite these steps, the recovery emails are still not being sent in production. I've been stuck on this for a while and can't figure out what I'm missing.
Does anyone have any ideas on why this might be happening or what else I should check?
Thanks in advance for your help!