feat(analytics-mailer): add gotify error logging
Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 2s
Monorepo Pipeline / 🧹 Lint (push) Failing after 1m21s
Monorepo Pipeline / 🧪 Test (push) Successful in 40s
Monorepo Pipeline / 🏗️ Build (push) Successful in 2m6s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped

This commit is contained in:
2026-07-21 11:38:19 +02:00
parent 09a85000bb
commit 39bb862fd6
2 changed files with 19 additions and 1 deletions

View File

@@ -33,6 +33,8 @@ jobs:
SMTP_USER: ${{ secrets.SMTP_USER }}
SMTP_PASS: ${{ secrets.SMTP_PASS }}
SMTP_SENDER: ${{ secrets.SMTP_SENDER }}
GOTIFY_URL: ${{ secrets.GOTIFY_URL }}
GOTIFY_TOKEN: ${{ secrets.GOTIFY_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4

View File

@@ -20,6 +20,9 @@ const SMTP_USER = process.env.SMTP_USER;
const SMTP_PASS = process.env.SMTP_PASS;
const SMTP_SENDER = process.env.SMTP_SENDER || "reports@mintel.me";
const GOTIFY_URL = process.env.GOTIFY_URL;
const GOTIFY_TOKEN = process.env.GOTIFY_TOKEN;
interface ConfigClient {
websiteId: string;
domain: string;
@@ -172,7 +175,20 @@ async function main() {
console.log(`Successfully sent to ${client.clientEmail}`);
}
} catch (e: any) {
console.error(`Failed to process client ${client.domain}:`, e.response?.data || e.message);
const errorMsg = e.response?.data || e.message;
console.error(`Failed to process client ${client.domain}:`, errorMsg);
if (GOTIFY_URL && GOTIFY_TOKEN) {
try {
await axios.post(`${GOTIFY_URL}/message?token=${GOTIFY_TOKEN}`, {
title: `❌ Analytics Mailer Error (${client.domain})`,
message: `Failed to generate or send report for ${client.domain}.\n\nError:\n${errorMsg}`,
priority: 8
});
} catch (gotifyErr: any) {
console.error("Failed to push to Gotify:", gotifyErr.message);
}
}
}
}