[SSF-159] - Automated Emails 1 Implementation#127
Conversation
Yurika-Kan
left a comment
There was a problem hiding this comment.
super great pr! super cool to test this & see emails come in as if i am the end user of this site :)
regarding the order of either saving to the db then sending emails and vice versa (specifically in request & user), i'd suggest to save the data first then send the appropriate email in cases that email sending fails. ideally we wouldn't wait for the email sending to succeed before saving that data. db is the source of truth & emails are more so secondary/side effect!
tested via:
- verified email -> postman -> receiving emails
- jest tests pass
thanks for adding all these tests btw!
Yurika-Kan
left a comment
There was a problem hiding this comment.
currently, the ui & backend could mismatch since ui would think it failed the req but entity/row was successfully created:
errorful email -> db saves & ses errors = throws 500 internal server error -> frontend catches & shows generic failure
i think making it so that email failures are observable but don't corrupt frontend would make sense - so i suggest using a try & catch for sending emails (in foodRequests, pantries, manufacturers, users)
thanks for updating the tests
tested:
- sending emails to admin, pantry, volunteer
- errorful email = db saves but ses errors (internal server error)
| pantryName: pantry.pantryName, | ||
| }); | ||
|
|
||
| await this.emailsService.sendEmails( |
There was a problem hiding this comment.
to make email non-blocking, can we wrap this in a try catch and send a logger warning indicating request created but email failed?
There was a problem hiding this comment.
see slack comments for what i suggested might be a better approach.
Yurika-Kan
left a comment
There was a problem hiding this comment.
LGTMMMM
thank you for this super splendid work 💯
Juwang110
left a comment
There was a problem hiding this comment.
Tested all emails send correctly for all flows, lgtm!!
ℹ️ Issue
Closes #159
📝 Description
✔️ Verification
BEFORE TESTING: Add 2 new environment variables:
Add your email that you put in the AWS_SES_SENDER_EMAIL into the following AWS SES Identities: https://us-east-2.console.aws.amazon.com/ses/home?region=us-east-2#/identities
Tested each workflow to ensure the proper sender, subject, message, attachments were all there.
🏕️ (Optional) Future Work / Notes
Should figure out why this email gets sent to spam by default