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
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:
@@ -33,6 +33,8 @@ jobs:
|
|||||||
SMTP_USER: ${{ secrets.SMTP_USER }}
|
SMTP_USER: ${{ secrets.SMTP_USER }}
|
||||||
SMTP_PASS: ${{ secrets.SMTP_PASS }}
|
SMTP_PASS: ${{ secrets.SMTP_PASS }}
|
||||||
SMTP_SENDER: ${{ secrets.SMTP_SENDER }}
|
SMTP_SENDER: ${{ secrets.SMTP_SENDER }}
|
||||||
|
GOTIFY_URL: ${{ secrets.GOTIFY_URL }}
|
||||||
|
GOTIFY_TOKEN: ${{ secrets.GOTIFY_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ const SMTP_USER = process.env.SMTP_USER;
|
|||||||
const SMTP_PASS = process.env.SMTP_PASS;
|
const SMTP_PASS = process.env.SMTP_PASS;
|
||||||
const SMTP_SENDER = process.env.SMTP_SENDER || "reports@mintel.me";
|
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 {
|
interface ConfigClient {
|
||||||
websiteId: string;
|
websiteId: string;
|
||||||
domain: string;
|
domain: string;
|
||||||
@@ -172,7 +175,20 @@ async function main() {
|
|||||||
console.log(`Successfully sent to ${client.clientEmail}`);
|
console.log(`Successfully sent to ${client.clientEmail}`);
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user