Fixed failed Resend initialization crashing entire application.
This commit is contained in:
@@ -15,7 +15,18 @@ import { indexApi } from './manticore.js';
|
||||
import { fetchScenesById } from './scenes.js';
|
||||
|
||||
const logger = initLogger();
|
||||
const resend = new Resend(config.email.apiKey);
|
||||
const resend = (() => {
|
||||
if (config.email.enabled) {
|
||||
try {
|
||||
return new Resend(config.email.apiKey);
|
||||
}
|
||||
catch (error) {
|
||||
logger.error(`Failed to initialize Resend: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
})();
|
||||
|
||||
function getImagePath(media) {
|
||||
if (!media) {
|
||||
@@ -437,7 +448,7 @@ const frequencies = {
|
||||
};
|
||||
|
||||
async function sendEmailAlerts() {
|
||||
if (!config.email.enabled) {
|
||||
if (!config.email.enabled || !resend) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user