File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -527,8 +527,13 @@ async function handleStuckDocs(client: SanityClient): Promise<{ audioGen: number
527527 */
528528export async function GET ( request : NextRequest ) {
529529 // Auth check
530+ const cronSecret = process . env . CRON_SECRET ;
531+ if ( ! cronSecret ) {
532+ console . error ( '[PIPELINE] CRON_SECRET not configured' ) ;
533+ return Response . json ( { error : 'Server misconfigured' } , { status : 503 } ) ;
534+ }
530535 const authHeader = request . headers . get ( 'authorization' ) ;
531- if ( authHeader !== `Bearer ${ process . env . CRON_SECRET } ` ) {
536+ if ( authHeader !== `Bearer ${ cronSecret } ` ) {
532537 console . error ( '[PIPELINE] Unauthorized cron request' ) ;
533538 return Response . json ( { error : 'Unauthorized' } , { status : 401 } ) ;
534539 }
Original file line number Diff line number Diff line change @@ -11,8 +11,13 @@ const COOLDOWN_DAYS = 14
1111
1212export async function POST ( request : Request ) {
1313 // Auth: Bearer token check against CRON_SECRET
14+ const cronSecret = process . env . CRON_SECRET ;
15+ if ( ! cronSecret ) {
16+ console . error ( '[SPONSOR] CRON_SECRET not configured' ) ;
17+ return new Response ( 'Server misconfigured' , { status : 503 } ) ;
18+ }
1419 const authHeader = request . headers . get ( 'authorization' )
15- if ( authHeader !== `Bearer ${ process . env . CRON_SECRET } ` ) {
20+ if ( authHeader !== `Bearer ${ cronSecret } ` ) {
1621 console . error ( '[SPONSOR] Outreach cron: unauthorized request' )
1722 return new Response ( 'Unauthorized' , { status : 401 } )
1823 }
You can’t perform that action at this time.
0 commit comments