Branch not being picked up after adding the vercel.json file

Hello,

I’ve been deploying my website on Vercel for a long time, and all branches have always been picked up correctly whenever I pushed changes.

Recently, I added a vercel.json file to handle my cron jobs. However, after adding this file, branch changes are no longer being detected by Vercel, and I can’t deploy them (they don’t show up in the UI).

Interestingly, whenever I create a new branch without the vercel.json file, it is correctly detected and automatically deployed.

My vercel.json

{
  "crons": [
    {
      "path": "/api/cron/some-route",
      "schedule": "30 * * * *"
    }
  ]
}

My /api/cron/some-route/route.ts

export async function GET(req: NextRequest) {
  if (req.headers.get('Authorization') !== `Bearer ${process.env.CRON_SECRET}`) {
    return NextResponse.json("Unauthorized", { status: 401 });
  }

  // some job

  return NextResponse.json({ ok: true });
}

By the way, I can successfully access the route with a GET request.

Fixed :confetti_ball:

It looks like the vercel.json file was misconfigured, specifically the schedule was incorrect.

I verified it using the Vercel cron expression checker and realized the issue. I ended up changing the schedule to run once per day, and after that, the deployment was successful.

{
  "crons": [
    {
      "path": "/api/cron/some-route",
      "schedule": "30 0 * * *"
    }
  ]
}
1 Like

Thanks for sharing your solution with the community @franckdsf :raised_hands:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.