Skip to content

Commit

Permalink
fix(mail): failure to render mail (#7890)
Browse files Browse the repository at this point in the history
* chore: add more logs

* fix: react-dom should be in deps not devDeps
  • Loading branch information
KenLSM authored Nov 15, 2024
1 parent 02bcba6 commit 2a22489
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
4 changes: 1 addition & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"promise-timeout": "^1.3.0",
"puppeteer-core": "22.6.3",
"react": "^18.3.0",
"react-dom": "^18.3.1",
"react-email": "^3.0.2",
"slick-carousel": "1.8.1",
"sns-validator": "^0.3.5",
Expand Down Expand Up @@ -226,7 +227,6 @@
"maildev": "^2.1.0",
"mockdate": "^3.0.5",
"prettier": "^3.3.3",
"react-dom": "^18.3.1",
"regenerator": "^0.14.10",
"rimraf": "^5.0.5",
"stripe-event-types": "^3.1.0",
Expand Down
48 changes: 39 additions & 9 deletions src/app/services/mail/mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,15 @@ export class MailService {

const generatedHtml = fromPromise(
render(BounceNotification(htmlData)),
() => {
(e) => {
logger.error({
message: 'Failed to render BounceNotification',
meta: {
action: 'sendBounceNotification',
error: e,
},
})

return new MailGenerationError(
'Error generating bounce notification email',
)
Expand Down Expand Up @@ -1095,10 +1103,16 @@ export class MailService {

const generatedHtml = fromPromise(
render(MrfWorkflowEmail(htmlData)),
() => {
return new MailGenerationError(
'Error generating bounce notification email',
)
(e) => {
logger.error({
message: 'Failed to render MrfWorkflowEmail',
meta: {
action: 'sendMRFWorkflowStepEmail',
error: e,
},
})

return new MailGenerationError('Error generating mrf workflow email')
},
)

Expand Down Expand Up @@ -1138,9 +1152,17 @@ export class MailService {

const generatedHtml = fromPromise(
render(MrfWorkflowCompletionEmail(htmlData)),
() => {
(e) => {
logger.error({
message: 'Failed to render MrfWorkflowCompletionEmail',
meta: {
action: 'sendMrfWorkflowCompletionEmail',
error: e,
},
})

return new MailGenerationError(
'Error generating bounce notification email',
'Error generating mrf workflow completion email',
)
},
)
Expand Down Expand Up @@ -1190,9 +1212,17 @@ export class MailService {

const generatedHtml = fromPromise(
render(MrfWorkflowCompletionEmail(htmlData)),
() => {
(e) => {
logger.error({
message: 'Failed to render MrfWorkflowCompletionEmail',
meta: {
action: 'sendMrfApprovalEmail',
error: e,
},
})

return new MailGenerationError(
'Error generating bounce notification email',
'Error generating mrf workflow completion email',
)
},
)
Expand Down

0 comments on commit 2a22489

Please sign in to comment.