From d8563bff2f3ad1fadda999a3e3371a12c1ff572a Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 23 Apr 2026 20:56:28 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/lovable/email/queue/process.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/routes/lovable/email/queue/process.ts b/src/routes/lovable/email/queue/process.ts index 4608eec..c424679 100644 --- a/src/routes/lovable/email/queue/process.ts +++ b/src/routes/lovable/email/queue/process.ts @@ -2,6 +2,11 @@ import { sendLovableEmail } from '@lovable.dev/email-js' import { createClient } from '@supabase/supabase-js' import { createFileRoute } from '@tanstack/react-router' +// The email infra tables (email_send_log, email_send_state, etc.) are not in +// the generated Database types, so we use an untyped client throughout this +// route. Tables are created by the email infra migration. +type AnyClient = ReturnType> + const MAX_RETRIES = 5 const DEFAULT_BATCH_SIZE = 10 const DEFAULT_SEND_DELAY_MS = 200 @@ -37,7 +42,7 @@ function getRetryAfterSeconds(error: unknown): number { // Move a message to the dead letter queue and log the reason. async function moveToDlq( - supabase: ReturnType, + supabase: AnyClient, queue: string, msg: { msg_id: number; message: Record }, reason: string @@ -89,7 +94,7 @@ export const Route = createFileRoute("/lovable/email/queue/process")({ return Response.json({ error: 'Forbidden' }, { status: 403 }) } - const supabase = createClient(supabaseUrl, supabaseServiceKey) + const supabase = createClient(supabaseUrl, supabaseServiceKey) // 1. Check rate-limit cooldown and read queue config const { data: state } = await supabase