diff --git a/packages/firebase/env/dev/env_secrets.dev.json b/packages/firebase/env/dev/env_secrets.dev.json index 651456440..7213cf6e1 100644 --- a/packages/firebase/env/dev/env_secrets.dev.json +++ b/packages/firebase/env/dev/env_secrets.dev.json @@ -3,6 +3,6 @@ "apiKey": "notrealapikey" }, "mail": { - "SENDGRID_API_KEY": "" + "SENDGRID_API_KEY": "SG.Gxxxxx" } } \ No newline at end of file diff --git a/packages/firebase/functions/src/notification/email/mailer.ts b/packages/firebase/functions/src/notification/email/mailer.ts index fdcf83538..b0818479b 100644 --- a/packages/firebase/functions/src/notification/email/mailer.ts +++ b/packages/firebase/functions/src/notification/email/mailer.ts @@ -8,12 +8,11 @@ const SENDGRID_APIKEY = 'SENDGRID_APIKEY'; const setApiKey = async () => { const apiKey = await getSecret(SENDGRID_APIKEY); sendgrid.setApiKey(apiKey); - env.mail.SENDGRID_API_KEY = apiKey; } export const sendMail = async (dest: string, subject: string, message: string, from = env.mail.sender, bcc = null): Promise => { - // if env.mail.SENDGRID_API_KEY has no value, set it with apiKey - !env.mail.SENDGRID_API_KEY && await setApiKey(); + // @question Moore, why are we awaiting this on every single mail we send? + await setApiKey(); await sendgrid.send({ to: dest,