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:
@@ -323,7 +323,7 @@ jobs:
|
|||||||
TARGET=$TARGET
|
TARGET=$TARGET
|
||||||
SENTRY_ENVIRONMENT=$TARGET
|
SENTRY_ENVIRONMENT=$TARGET
|
||||||
PROJECT_NAME=$PROJECT_NAME
|
PROJECT_NAME=$PROJECT_NAME
|
||||||
TRAEFIK_HOST_RULE='$TRAEFIK_RULE'
|
TRAEFIK_HOST_RULE=$TRAEFIK_RULE
|
||||||
TRAEFIK_HOST=$TRAEFIK_HOST
|
TRAEFIK_HOST=$TRAEFIK_HOST
|
||||||
ENV_FILE=$ENV_FILE
|
ENV_FILE=$ENV_FILE
|
||||||
COMPOSE_PROFILES=$COMPOSE_PROFILES
|
COMPOSE_PROFILES=$COMPOSE_PROFILES
|
||||||
|
|||||||
@@ -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}"
|
- "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)
|
# 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.entrypoints=websecure"
|
||||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls.certresolver=le"
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls.certresolver=le"
|
||||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls=true"
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls=true"
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ async function verifyImage(path: string): Promise<boolean> {
|
|||||||
|
|
||||||
const contentType = response.headers.get('content-type');
|
const contentType = response.headers.get('content-type');
|
||||||
if (!contentType?.includes('image/png')) {
|
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();
|
const buffer = await response.arrayBuffer();
|
||||||
|
|||||||
Reference in New Issue
Block a user