Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/api/cron/check-renders/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,13 @@ async function handleStuckDocs(client: SanityClient): Promise<{ audioGen: number
*/
export async function GET(request: NextRequest) {
// Auth check
const cronSecret = process.env.CRON_SECRET;
if (!cronSecret) {
console.error('[PIPELINE] CRON_SECRET not configured');
return Response.json({ error: 'Server misconfigured' }, { status: 503 });
}
const authHeader = request.headers.get('authorization');
if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
if (authHeader !== `Bearer ${cronSecret}`) {
console.error('[PIPELINE] Unauthorized cron request');
return Response.json({ error: 'Unauthorized' }, { status: 401 });
}
Expand Down
7 changes: 6 additions & 1 deletion app/api/cron/sponsor-outreach/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ const COOLDOWN_DAYS = 14

export async function POST(request: Request) {
// Auth: Bearer token check against CRON_SECRET
const cronSecret = process.env.CRON_SECRET;
if (!cronSecret) {
console.error('[SPONSOR] CRON_SECRET not configured');
return new Response('Server misconfigured', { status: 503 });
}
const authHeader = request.headers.get('authorization')
if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
if (authHeader !== `Bearer ${cronSecret}`) {
console.error('[SPONSOR] Outreach cron: unauthorized request')
return new Response('Unauthorized', { status: 401 })
}
Expand Down
Loading