mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 21:51:14 -05:00
Add edge function logging
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts';
|
||||
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2';
|
||||
import { edgeLogger } from '../_shared/logger.ts';
|
||||
|
||||
const corsHeaders = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
@@ -34,7 +35,7 @@ serve(async (req) => {
|
||||
throw new Error('Unauthorized');
|
||||
}
|
||||
|
||||
console.log(`Cancelling deletion request for user: ${user.id}`);
|
||||
edgeLogger.info('Cancelling deletion request', { action: 'cancel_deletion', userId: user.id });
|
||||
|
||||
// Find pending deletion request
|
||||
const { data: deletionRequest, error: requestError } = await supabaseClient
|
||||
@@ -100,9 +101,9 @@ serve(async (req) => {
|
||||
`,
|
||||
}),
|
||||
});
|
||||
console.log('Cancellation confirmation email sent');
|
||||
edgeLogger.info('Cancellation confirmation email sent', { action: 'cancel_deletion_email', userId: user.id });
|
||||
} catch (emailError) {
|
||||
console.error('Failed to send email:', emailError);
|
||||
edgeLogger.error('Failed to send email', { action: 'cancel_deletion_email', userId: user.id });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +118,7 @@ serve(async (req) => {
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Error cancelling deletion:', error);
|
||||
edgeLogger.error('Error cancelling deletion', { action: 'cancel_deletion_error', error: error instanceof Error ? error.message : String(error) });
|
||||
return new Response(
|
||||
JSON.stringify({ error: error.message }),
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user