fix: remove legacy CMS health checks and update verification routes
This commit is contained in:
@@ -350,66 +350,7 @@ async function main() {
|
||||
hasErrors = true;
|
||||
}
|
||||
|
||||
// 5. Cleanup: Delete test submissions from Payload CMS
|
||||
console.log(`\n🧹 Starting cleanup of test submissions...`);
|
||||
const payloadSecret = process.env.PAYLOAD_SECRET;
|
||||
|
||||
if (!payloadSecret) {
|
||||
console.warn(
|
||||
` ⚠️ PAYLOAD_SECRET not found in environment. Cleanup will likely fail with 403 if the server expects a secret.`,
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
` 🔐 PAYLOAD_SECRET found (${payloadSecret.substring(0, 3)}...). Sending x-e2e-secret header.`,
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const apiUrl = `${targetUrl.replace(/\/$/, '')}/api/form-submissions`;
|
||||
// We fetch ALL submissions matching the test email to clean up potential lefovers from previous runs
|
||||
const searchUrl = `${apiUrl}?where[email][equals]=testing@mintel.me&limit=100`;
|
||||
|
||||
// Fetch test submissions with bypass header
|
||||
const searchResponse = await axios.get(searchUrl, {
|
||||
headers: {
|
||||
Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`,
|
||||
'x-e2e-secret': payloadSecret || '',
|
||||
},
|
||||
});
|
||||
|
||||
const testSubmissions = searchResponse.data.docs || [];
|
||||
console.log(` Found ${testSubmissions.length} test submissions to clean up.`);
|
||||
|
||||
for (const doc of testSubmissions) {
|
||||
try {
|
||||
await axios.delete(`${apiUrl}/${doc.id}`, {
|
||||
headers: {
|
||||
Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`,
|
||||
'x-e2e-secret': payloadSecret || '',
|
||||
},
|
||||
});
|
||||
console.log(` ✅ Deleted submission: ${doc.id} (${doc.name})`);
|
||||
} catch (delErr: any) {
|
||||
console.warn(` ⚠️ Cleanup attempt on ${doc.id} failed: ${delErr.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (testSubmissions.length > 0) {
|
||||
console.log(`✅ Cleanup completed successfully.`);
|
||||
}
|
||||
} catch (err: any) {
|
||||
if (err.response?.status === 403) {
|
||||
console.error(` ❌ Cleanup failed with 403 Forbidden.`);
|
||||
console.error(` Detail: The server rejected the x-e2e-secret header.`);
|
||||
console.error(` Server Response: ${JSON.stringify(err.response.data)}`);
|
||||
} else {
|
||||
console.error(` ❌ Cleanup fetch failed: ${err.message}`);
|
||||
if (err.response) {
|
||||
console.error(` Status: ${err.response.status}`);
|
||||
console.error(` Body: ${JSON.stringify(err.response.data)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`\n🧹 Skipping cleanup (No CMS/DB active in this infrastructure).`);
|
||||
|
||||
await browser.close();
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ const routes = [
|
||||
'/de/opengraph-image',
|
||||
'/en/opengraph-image',
|
||||
'/de/blog/opengraph-image',
|
||||
'/de/api/og/product?slug=low-voltage-cables',
|
||||
'/en/api/og/product?slug=medium-voltage-cables',
|
||||
'/de/kontakt/opengraph-image',
|
||||
'/en/contact/opengraph-image',
|
||||
];
|
||||
|
||||
async function verifyImage(path: string): Promise<boolean> {
|
||||
|
||||
Reference in New Issue
Block a user