@@ -85,6 +85,8 @@ const app = new Elysia()
8585 . get ( "/health" , ( ) => ( { status : "ok" } ) )
8686 . post ( "/" , async ( { headers, body } ) => {
8787 try {
88+ console . log ( "Received headers:" , JSON . stringify ( headers , null , 2 ) ) ;
89+
8890 const headerSchema = z . object ( {
8991 "upstash-signature" : z . string ( ) ,
9092 "x-schedule-id" : z . string ( ) ,
@@ -93,7 +95,17 @@ const app = new Elysia()
9395
9496 const parsed = headerSchema . safeParse ( headers ) ;
9597 if ( ! parsed . success ) {
96- return new Response ( "Missing required headers" , { status : 400 } ) ;
98+ console . error ( "Header validation failed:" , parsed . error . format ( ) ) ;
99+ return new Response (
100+ JSON . stringify ( {
101+ error : "Missing required headers" ,
102+ details : parsed . error . format ( )
103+ } ) ,
104+ {
105+ status : 400 ,
106+ headers : { "Content-Type" : "application/json" }
107+ }
108+ ) ;
97109 }
98110
99111 const { "upstash-signature" : signature , "x-schedule-id" : scheduleId } =
@@ -110,10 +122,23 @@ const app = new Elysia()
110122 return new Response ( "Invalid signature" , { status : 401 } ) ;
111123 }
112124
125+ console . log ( `Looking up schedule: ${ scheduleId } ` ) ;
126+
113127 const schedule = await lookupSchedule ( scheduleId ) ;
114128 if ( ! schedule . success ) {
129+ console . error ( `Schedule lookup failed: ${ schedule . error } ` ) ;
115130 captureError ( schedule . error ) ;
116- return new Response ( "Schedule not found" , { status : 404 } ) ;
131+ return new Response (
132+ JSON . stringify ( {
133+ error : "Schedule not found" ,
134+ scheduleId,
135+ details : schedule . error
136+ } ) ,
137+ {
138+ status : 404 ,
139+ headers : { "Content-Type" : "application/json" }
140+ }
141+ ) ;
117142 }
118143
119144 const monitorId = schedule . data . websiteId || scheduleId ;
0 commit comments