timothymiller / t4-app

Full stack meta-framework for building iOS, Android, and Progressive Web Apps with Tamagui and deploying to Cloudflare.
https://t4stack.com
MIT License
1.49k stars 82 forks source link

Lucia branch: Check `sendResult` and forward `PUBLIC_SUPPORT_EMAIL` and `RESEND_API_KEY` vars to CF deployment #130

Open Boscop opened 10 months ago

Boscop commented 10 months ago

When the user wants to reset their password, the call to the backend returns 200 so the frontend thinks the email was sent, but the email doesn't get sent: In the resend.com logs, it shows HTTP error 422 because the from field is missing in the payload:

{
    "name": "missing_required_field",
    "message": "Missing `from` field.",
    "statusCode": 422
}
image

I just saw that there's a TODO in the code to check the sendResult: https://github.com/timothymiller/t4-app/blob/325b5e58a39bf9cd4019db6273ad6ce62889cf2d/packages/api/src/auth/user.ts#L224

In this case, from was missing because it's passed like this https://github.com/timothymiller/t4-app/blob/325b5e58a39bf9cd4019db6273ad6ce62889cf2d/packages/api/src/auth/user.ts#L214 and PUBLIC_SUPPORT_EMAIL was undefined.

So we could use this issue to cover both:

rmarscher commented 10 months ago

:+1: makes sense. I'm not personally super motivated to implement this... so if someone else wants to submit a PR... 🎉