brackt/app/lib/cron-auth.ts
Chris Parsons 97a92aba7d
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 2m57s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m29s
🚀 Deploy / 🧪 Test (push) Successful in 2m52s
🚀 Deploy / ʦ🔍 Typecheck & Lint (push) Successful in 1m28s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
🚀 Deploy / 🐳 Build (push) Successful in 1m16s
🚀 Deploy / 🚀 Deploy (push) Successful in 11s
Debug sync-and-simulate cron job: surface curl output and log auth failures
Remove -s (silent) from curl so CI logs show the HTTP response on failure.
Add logger.error in requireCronSecret so 401s from bad/missing secrets appear in Sentry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 16:50:30 +00:00

10 lines
417 B
TypeScript

import { logger } from "~/lib/logger";
export function requireCronSecret(request: Request): void {
const secret = process.env.CRON_SECRET;
if (!secret) throw new Response("CRON_SECRET not configured", { status: 500 });
if (request.headers.get("x-cron-secret") !== secret) {
logger.error("[cron-auth] Invalid or missing X-Cron-Secret header");
throw new Response("Unauthorized", { status: 401 });
}
}