Fix edge function console statements

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 19:09:28 +00:00
parent 7663205512
commit c0f468451f
8 changed files with 92 additions and 64 deletions

View File

@@ -1,6 +1,6 @@
import { serve } from "https://deno.land/std@0.190.0/http/server.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.57.4";
import { startRequest, endRequest } from "../_shared/logger.ts";
import { edgeLogger, startRequest, endRequest } from "../_shared/logger.ts";
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
@@ -176,7 +176,8 @@ serve(async (req) => {
is_duplicate: true
}).eq('id', existingLog.id);
console.log('Duplicate notification prevented:', {
edgeLogger.info('Duplicate notification prevented', {
action: 'notify_user_submission_status',
userId: user_id,
idempotencyKey,
submissionId: submission_id,
@@ -203,7 +204,8 @@ serve(async (req) => {
);
}
console.log('Sending notification to user:', {
edgeLogger.info('Sending notification to user', {
action: 'notify_user_submission_status',
userId: user_id,
workflowId,
entityName,
@@ -241,7 +243,7 @@ serve(async (req) => {
}
});
console.log('User notification sent successfully:', notificationResult);
edgeLogger.info('User notification sent successfully', { action: 'notify_user_submission_status', requestId: tracking.requestId, result: notificationResult });
endRequest(tracking, 200);
@@ -262,7 +264,7 @@ serve(async (req) => {
);
} catch (error: unknown) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
console.error('Error notifying user about submission status:', errorMessage);
edgeLogger.error('Error notifying user about submission status', { action: 'notify_user_submission_status', requestId: tracking.requestId, error: errorMessage });
endRequest(tracking, 500, errorMessage);