From 350b1919f32703a65d06a45fce9e51b7d7afcde5 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Thu, 12 Feb 2026 21:35:45 +0100 Subject: [PATCH] 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). --- .gitea/workflows/deploy.yml | 2 +- docker-compose.yml | 2 +- scripts/check-og-images.ts | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index ae25f5c9..d5f38dbb 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 4a936a6b..19b58e70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" diff --git a/scripts/check-og-images.ts b/scripts/check-og-images.ts index 25428035..9659a149 100644 --- a/scripts/check-og-images.ts +++ b/scripts/check-og-images.ts @@ -28,7 +28,10 @@ async function verifyImage(path: string): Promise { 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();