I'm on the Hobby plan. I have 2 cron jobs set up: /api/send-email (0 2 * * 5) and /api/send-churn-followup-email (5 17 * * 0-4,6). The cron schedules don't overlap (second doesn't run on day 5), so I shouldn't be exceeding my Hobby limit of 1 per day. However, I've found that the functions don't run at all. I've waited through the 1 hour window and a 24 hour window. I don't see anything in the logs. I know my functions work because pressing the "Run" button returns status code 200 and I can see the result of the function call in my DB. I have also been through the Cron Job troubleshooting guide with no luck.
Current behavior: function doesn't run without clicking run manually Expected behavior: function runs at schedule time
Here's how both routes are set up:
import { createClient, SupabaseClient } from '@supabase/supabase-js';import { Resend } from 'resend';import { NextResponse } from 'next/server';
export const dynamic = 'force-dynamic';
const resend = new Resend(process.env.RESEND_API_KEY);
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!;const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY!;const supabase = createClient(supabaseUrl, supabaseServiceRoleKey);
async function* getAllUsers(supabase: SupabaseClient) { ...}
export async function GET(request: Request) { try { const authHeader = request.headers.get('Authorization'); const token = authHeader?.split(' ')[1]; // Extract token from "Bearer <token>" if (!token || token !== process.env.CRON_SECRET) { return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); } // Actual function - creating and sending an email with Resend based on Supabase data
// Wait for all emails to be sent await Promise.all(batchPromises);
return NextResponse.json({ message: 'Follow-up emails sent successfully', emailsSent: targetUsers.length }, { status: 200 });
} catch (error) { console.error('Error sending follow-up emails:', error); return NextResponse.json({ error: 'Failed to send follow-up emails' }, { status: 500 }); }}Project information: Hobby plan, production environment, Next.js, https://vercel.com/rohan-tanejas-projects-0e2d4e45/buildlist-frontend