Skip to content

Open-source status page, incident response and uptime monitoring

715 B
Raw Blame
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";

import { cron, isAuthorizedDomain } from "../_cron";
import { runSentryCron } from "../_sentry";

export const runtime = "nodejs";
// export const preferredRegion = ["auto"];
export const dynamic = "force-dynamic";
export const maxDuration = 300;
export const revalidate = 0;

export async function GET(req: NextRequest) {
  if (isAuthorizedDomain(req.url)) {
    const { cronCompleted, cronFailed } = runSentryCron("1-m-cron");
    try {
      await cron({ periodicity: "1m", req });
      await cronCompleted();
    } catch (_error) {
      await cronFailed();
    }
  }
  return NextResponse.json({ success: true });
}