fix(deploy): auto-run payload migrations on deploy, hide cms error details from visitors
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 9s
Build & Deploy / 🧪 QA (push) Successful in 3m3s
Build & Deploy / 🏗️ Build (push) Successful in 19m36s
Build & Deploy / 🚀 Deploy (push) Successful in 1m25s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 21s

This commit is contained in:
2026-03-04 17:57:01 +01:00
parent 69b8ae9067
commit f1d0227260
3 changed files with 52 additions and 34 deletions

View File

@@ -15,10 +15,12 @@ export default function CMSConnectivityNotice() {
const isDebug = new URLSearchParams(window.location.search).has('cms_debug');
const isLocal = config.isDevelopment;
const isTesting = config.isTesting;
const target = process.env.NEXT_PUBLIC_TARGET || '';
const isBranch = target === 'branch';
// Only proceed with check if it's developer context (Local or Testing)
// Only proceed with check if it's developer context (Local, Testing, or Branch preview)
// Staging and Production should NEVER see this unless forced with ?cms_debug
if (!isLocal && !isTesting && !isDebug) return;
if (!isLocal && !isTesting && !isBranch && !isDebug) return;
try {
const response = await fetch('/api/health/cms');
@@ -58,8 +60,8 @@ export default function CMSConnectivityNotice() {
<h4 className="font-bold text-sm mb-1">CMS Issue Detected</h4>
<p className="text-xs opacity-90 leading-relaxed mb-3">
{errorMsg === 'relation "products" does not exist'
? 'The database schema is missing. Please sync your local data to this environment.'
: errorMsg || 'The application cannot connect to the Directus CMS.'}
? 'The database schema is missing. Please run migrations for this environment.'
: 'A content service is unavailable. Check the deployment logs for details.'}
</p>
<div className="flex gap-2">
<button