Skip to content

Add daily Vercel Cron for scheduled docs reindex#9

Merged
BunsDev merged 1 commit into
mainfrom
add-reindex-cron
Jun 21, 2026
Merged

Add daily Vercel Cron for scheduled docs reindex#9
BunsDev merged 1 commit into
mainfrom
add-reindex-cron

Conversation

@BunsDev

@BunsDev BunsDev commented Jun 20, 2026

Copy link
Copy Markdown
Member

Adds a daily Vercel Cron (06:00 UTC) triggering the docs reindex as a safety net for missed GitHub webhooks. Vercel Cron triggers via GET, but reindex logic lived only on POST; this extracts a shared runReindex() helper and has GET run it when authorized (Vercel injects Authorization: Bearer CRON_SECRET, validated against REINDEX_SECRET || CRON_SECRET). Unauthenticated GET still returns the status check; POST unchanged. vercel.json gains a crons entry. Deploy note: CRON_SECRET must be set in Vercel Production (same value as REINDEX_SECRET). tsc clean; built in an isolated worktree.

🤖 Generated with Claude Code

Vercel Cron triggers endpoints via GET, but the reindex logic lived only
on POST. Extract the reindex into a shared runReindex() helper and have
the GET handler run it when the request is authorized (Vercel injects
Authorization: Bearer ${CRON_SECRET}); unauthenticated GET still returns
the plain status check. POST behavior is unchanged.

Add a crons entry to vercel.json to hit /api/cron/reindex daily at
06:00 UTC. This is a safety net for missed GitHub webhooks; the freshness
guard skips when docs are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 20, 2026 06:07
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
opencoven-chat-api Ready Ready Preview Jun 20, 2026 6:07am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a daily Vercel Cron trigger to the docs reindex endpoint to ensure reindexing still happens if GitHub webhooks are missed, by enabling authorized GET requests to run the same reindex logic as POST.

Changes:

  • Add a daily (06:00 UTC) Vercel Cron schedule for the reindex endpoint.
  • Refactor cron route logic by extracting a shared runReindex() helper and invoking it from authorized GET requests.
  • Keep unauthenticated GET as a status check while preserving existing POST behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
vercel.json Registers a daily Vercel Cron job calling the reindex API route.
app/api/cron/reindex/route.ts Extracts shared reindex execution into runReindex() and enables authorized GET-triggered reindexing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +84 to +94
export async function GET(request: NextRequest) {
if (getConfiguredSecret() && isAuthorizedReindexRequest(request)) {
return runReindex(request);
}

return NextResponse.json({
status: "ok",
endpoint: "scheduled docs reindex",
configured: Boolean(getConfiguredSecret()),
});
}
@BunsDev BunsDev merged commit d3c0069 into main Jun 21, 2026
2 checks passed
@BunsDev BunsDev deleted the add-reindex-cron branch June 21, 2026 02:27
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.

2 participants