fix(og): diagnostic fix for CI OG image check

- Updated scripts/check-og-images.ts to log response body on failure.
- Refined Traefik public router rule in docker-compose.yml for better path matching.
- Fixed TRAEFIK_HOST_RULE assignment in deploy.yml (removed literal single quotes).
This commit is contained in:
2026-02-12 21:35:45 +01:00
parent 081e1466f2
commit 350b1919f3
3 changed files with 6 additions and 3 deletions

View File

@@ -323,7 +323,7 @@ jobs:
TARGET=$TARGET
SENTRY_ENVIRONMENT=$TARGET
PROJECT_NAME=$PROJECT_NAME
TRAEFIK_HOST_RULE='$TRAEFIK_RULE'
TRAEFIK_HOST_RULE=$TRAEFIK_RULE
TRAEFIK_HOST=$TRAEFIK_HOST
ENV_FILE=$ENV_FILE
COMPOSE_PROFILES=$COMPOSE_PROFILES

View File

@@ -22,7 +22,7 @@ services:
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.middlewares=${AUTH_MIDDLEWARE:-${PROJECT_NAME:-klz-cables}-ratelimit,${PROJECT_NAME:-klz-cables}-forward,${PROJECT_NAME:-klz-cables}-compress}"
# Public Router (Whitelist for OG Images, Sitemaps, Health)
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.rule=(${TRAEFIK_HOST_RULE:-Host(`klz-cables.com`)}) && (PathPrefix(`/health`, `/sitemap.xml`, `/robots.txt`, `/manifest.webmanifest`) || PathRegexp(`^/.*/api/og/.*`) || PathRegexp(`^/.*/opengraph-image$`))"
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.rule=(${TRAEFIK_HOST_RULE:-Host(`klz-cables.com`)}) && (PathPrefix(`/health`, `/sitemap.xml`, `/robots.txt`, `/manifest.webmanifest`, `/api/og`) || PathRegexp(`^/.*opengraph-image$`))"
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.entrypoints=websecure"
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls.certresolver=le"
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls=true"

View File

@@ -28,7 +28,10 @@ async function verifyImage(path: string): Promise<boolean> {
const contentType = response.headers.get('content-type');
if (!contentType?.includes('image/png')) {
throw new Error(`Content-Type: ${contentType}`);
const body = await response.text();
throw new Error(
`Content-Type: ${contentType}. Body: ${body.substring(0, 200).replace(/\n/g, ' ')}...`,
);
}
const buffer = await response.arrayBuffer();