From 4703d1fa0c15651fe9340e5e0e09c444aa7b4d28 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Sun, 21 Jul 2024 20:36:03 -0700 Subject: [PATCH] Fixed unawaited promise in email service --- Server/service/emailService.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Server/service/emailService.js b/Server/service/emailService.js index 97982a576..79d6213c6 100644 --- a/Server/service/emailService.js +++ b/Server/service/emailService.js @@ -66,10 +66,10 @@ class EmailService { * @returns {Promise} A promise that resolves to the messageId of the sent email. */ buildAndSendEmail = async (template, context, to, subject) => { - const buildHtml = (template, context) => { + const buildHtml = async (template, context) => { const mjml = this.templateLookup[template](context); - const html = mjml2html(mjml).html; - return html; + const html = await mjml2html(mjml); + return html.html; }; const sendEmail = async (to, subject, html) => { @@ -80,7 +80,11 @@ class EmailService { }); return info; }; - const info = await sendEmail(to, subject, buildHtml(template, context)); + const info = await sendEmail( + to, + subject, + await buildHtml(template, context) + ); return info.messageId; }; }