Skip to content

chore: add Supabase keepalive endpoint and schedule cron job#33

Merged
DongDuong2001 merged 2 commits into
mainfrom
chore-vercel-supabase-keepalive
May 31, 2026
Merged

chore: add Supabase keepalive endpoint and schedule cron job#33
DongDuong2001 merged 2 commits into
mainfrom
chore-vercel-supabase-keepalive

Conversation

@DongDuong2001

@DongDuong2001 DongDuong2001 commented May 31, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces a scheduled health check endpoint for Supabase and configures a Vercel cron job to periodically invoke it. The main goal is to ensure the Supabase connection remains active and to monitor its health.

Supabase keepalive endpoint:

  • Added a new API route app/api/cron/supabase-keepalive/route.ts that performs an authenticated health check on the Supabase profiles table, returning latency and row count information; it responds with an error if the check fails or if authorization is invalid.

Cron job configuration:

  • Updated vercel.json to schedule a daily (3:00 AM UTC) cron job that triggers the new /api/cron/supabase-keepalive endpoint, ensuring regular health checks.

Summary by CodeRabbit

  • Chores
    • Added a new scheduled daily background task for backend infrastructure.

@DongDuong2001 DongDuong2001 self-assigned this May 31, 2026
@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lab68dev-platform-1ds5 Ready Ready Preview, Comment May 31, 2026 12:28pm

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8cadaa24-4f33-4e56-bda5-fbfa891211ce

📥 Commits

Reviewing files that changed from the base of the PR and between 1efb710 and 098f105.

📒 Files selected for processing (2)
  • app/api/cron/supabase-keepalive/route.ts
  • vercel.json

📝 Walkthrough

Walkthrough

This PR adds a Supabase health check cron job. A new Next.js API route authenticates requests, creates a Supabase admin client, queries the profiles table, measures latency, and returns status. Vercel's cron configuration is updated to trigger this endpoint daily at 03:00 UTC.

Changes

Supabase Keepalive Cron Health Check

Layer / File(s) Summary
Keepalive endpoint implementation
app/api/cron/supabase-keepalive/route.ts
GET handler validates authorization: Bearer header against CRON_SECRET, creates Supabase admin client, executes exact-count query on profiles table, measures latency in milliseconds, and returns { ok: true, checked: 'profiles', count, latencyMs } on success or 401/500/502 on auth/client/query failures.
Cron schedule configuration
vercel.json
Adds crons configuration that triggers /api/cron/supabase-keepalive on a daily schedule at 0 3 * * * (03:00 UTC).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop through the database each morning dawn,
Our health check bounces till the night is gone,
From Supabase whispers, latency we measure,
Every three o'clock brings a cron's sweet pleasure!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore-vercel-supabase-keepalive

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@supabase

supabase Bot commented May 31, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xafgcrldyuapvnimoler because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@DongDuong2001 DongDuong2001 marked this pull request as ready for review May 31, 2026 13:04
@DongDuong2001 DongDuong2001 merged commit 31984ff into main May 31, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant