fix(ci): align PAYLOAD_SECRET for post-deploy cleanup and enhance diagnostics
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Successful in 1m18s
Build & Deploy / 🏗️ Build (push) Successful in 3m53s
Build & Deploy / 🚀 Deploy (push) Successful in 21s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 5m33s
Build & Deploy / 🔔 Notify (push) Successful in 2s

This commit is contained in:
2026-04-27 13:58:26 +02:00
parent 263640bce5
commit de0089f068
3 changed files with 36 additions and 24 deletions

View File

@@ -532,7 +532,7 @@ jobs:
env: env:
NEXT_PUBLIC_BASE_URL: ${{ needs.prepare.outputs.next_public_url }} NEXT_PUBLIC_BASE_URL: ${{ needs.prepare.outputs.next_public_url }}
GATEKEEPER_PASSWORD: ${{ secrets.GATEKEEPER_PASSWORD || 'klz2026' }} GATEKEEPER_PASSWORD: ${{ secrets.GATEKEEPER_PASSWORD || 'klz2026' }}
PAYLOAD_SECRET: ${{ secrets.PAYLOAD_SECRET || vars.PAYLOAD_SECRET }} PAYLOAD_SECRET: ${{ secrets.PAYLOAD_SECRET || vars.PAYLOAD_SECRET || 'you-need-to-set-a-payload-secret' }}
PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium
run: pnpm run check:forms run: pnpm run check:forms

View File

@@ -139,7 +139,7 @@
"prepare": "husky", "prepare": "husky",
"preinstall": "npx only-allow pnpm" "preinstall": "npx only-allow pnpm"
}, },
"version": "2.3.22-rc.2", "version": "2.3.22-rc.3",
"pnpm": { "pnpm": {
"onlyBuiltDependencies": [ "onlyBuiltDependencies": [
"@parcel/watcher", "@parcel/watcher",

View File

@@ -115,7 +115,9 @@ async function main() {
// Intercept Next.js chunks and data to bypass Varnish 404-caching // Intercept Next.js chunks and data to bypass Varnish 404-caching
// Includes standard /_next/ and subpath /gatekeeper/_next/ // Includes standard /_next/ and subpath /gatekeeper/_next/
if ( if (
(url.includes('/_next/static/') || url.includes('/_next/data/') || url.includes('/gatekeeper/_next/')) && (url.includes('/_next/static/') ||
url.includes('/_next/data/') ||
url.includes('/gatekeeper/_next/')) &&
!url.includes('?cb=') && !url.includes('?cb=') &&
!url.includes('&cb=') !url.includes('&cb=')
) { ) {
@@ -167,7 +169,9 @@ async function main() {
if (chunkErrorsDetected) { if (chunkErrorsDetected) {
const buster = `cb=${Date.now()}`; const buster = `cb=${Date.now()}`;
const cbUrl = finalUrl.includes('?') ? `${finalUrl}&${buster}` : `${finalUrl}?${buster}`; const cbUrl = finalUrl.includes('?') ? `${finalUrl}&${buster}` : `${finalUrl}?${buster}`;
console.warn(` ⚠️ Assets failed to load (Varnish staleness suspected). Retrying with cache-buster: ${cbUrl}`); console.warn(
` ⚠️ Assets failed to load (Varnish staleness suspected). Retrying with cache-buster: ${cbUrl}`,
);
chunkErrorsDetected = false; chunkErrorsDetected = false;
await page.goto(cbUrl, { waitUntil: 'networkidle2', timeout: 30000 }); await page.goto(cbUrl, { waitUntil: 'networkidle2', timeout: 30000 });
} }
@@ -351,7 +355,13 @@ async function main() {
const payloadSecret = process.env.PAYLOAD_SECRET; const payloadSecret = process.env.PAYLOAD_SECRET;
if (!payloadSecret) { if (!payloadSecret) {
console.warn(` ⚠️ PAYLOAD_SECRET not found in environment. Cleanup will likely fail with 403.`); 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 { try {
@@ -380,9 +390,7 @@ async function main() {
}); });
console.log(` ✅ Deleted submission: ${doc.id} (${doc.name})`); console.log(` ✅ Deleted submission: ${doc.id} (${doc.name})`);
} catch (delErr: any) { } catch (delErr: any) {
console.warn( console.warn(` ⚠️ Cleanup attempt on ${doc.id} failed: ${delErr.message}`);
` ⚠️ Cleanup attempt on ${doc.id} failed: ${delErr.message}`,
);
} }
} }
@@ -391,11 +399,15 @@ async function main() {
} }
} catch (err: any) { } catch (err: any) {
if (err.response?.status === 403) { if (err.response?.status === 403) {
console.error( console.error(` ❌ Cleanup failed with 403 Forbidden.`);
` ❌ Cleanup failed with 403 Forbidden. Ensure FormSubmissions access control and PAYLOAD_SECRET are aligned.`, console.error(` Detail: The server rejected the x-e2e-secret header.`);
); console.error(` Server Response: ${JSON.stringify(err.response.data)}`);
} else { } else {
console.error(` ❌ Cleanup fetch failed: ${err.message}`); console.error(` ❌ Cleanup fetch failed: ${err.message}`);
if (err.response) {
console.error(` Status: ${err.response.status}`);
console.error(` Body: ${JSON.stringify(err.response.data)}`);
}
} }
} }