diff --git a/app/actions/contact.ts b/app/actions/contact.ts index 03301fcf..0b9956ba 100644 --- a/app/actions/contact.ts +++ b/app/actions/contact.ts @@ -111,13 +111,20 @@ export async function sendContactFormAction(formData: FormData) { return { success: true }; } catch (error) { - logger.error('Failed to send branded emails', { error }); + const errorMsg = error instanceof Error ? error.message : String(error); + logger.error('Failed to send branded emails', { + error: errorMsg, + stack: error instanceof Error ? error.stack : undefined, + }); + services.errors.captureException(error, { action: 'sendContactFormAction', email }); + await services.notifications.notify({ title: '🚨 Contact Form Error', - message: `Failed to send emails for ${name} (${email}). Error: ${JSON.stringify(error)}`, + message: `Failed to send emails for ${name} (${email}). Error: ${errorMsg}`, priority: 8, }); - return { success: false, error }; + + return { success: false, error: errorMsg }; } } diff --git a/components/ContactForm.tsx b/components/ContactForm.tsx index 4d3f321f..e2cfe761 100644 --- a/components/ContactForm.tsx +++ b/components/ContactForm.tsx @@ -20,7 +20,7 @@ export default function ContactForm() { try { const result = await sendContactFormAction(formData); - if (result.success) { + if (result?.success) { trackEvent('contact_form_submission', { form_type: 'general', email, diff --git a/lib/mail/mailer.ts b/lib/mail/mailer.ts index 9168d7b2..89898804 100644 --- a/lib/mail/mailer.ts +++ b/lib/mail/mailer.ts @@ -48,7 +48,8 @@ export async function sendEmail({ to, subject, html }: SendEmailOptions) { logger.info('Email sent successfully', { messageId: info.messageId, subject, recipients }); return { success: true, messageId: info.messageId }; } catch (error) { - logger.error('Error sending email', { error, subject, recipients }); - return { success: false, error }; + const errorMsg = error instanceof Error ? error.message : String(error); + logger.error('Error sending email', { error: errorMsg, subject, recipients }); + return { success: false, error: errorMsg }; } } diff --git a/scripts/sync-directus.sh b/scripts/sync-directus.sh index 2be79ca3..fd31f285 100755 --- a/scripts/sync-directus.sh +++ b/scripts/sync-directus.sh @@ -97,6 +97,10 @@ if [ "$ACTION" == "push" ]; then rm dump.sql ssh "$REMOTE_HOST" "rm $REMOTE_DIR/dump.sql" + # 5. Restart Directus to trigger migrations and refresh schema cache + echo "🔄 Restarting remote Directus to apply migrations..." + ssh "$REMOTE_HOST" "cd $REMOTE_DIR && docker compose -p $PROJECT_NAME restart directus" + echo "✨ Push to $ENV complete!" elif [ "$ACTION" == "pull" ]; then