Next.js Discord

Discord Forum

Cron jobs stopped running

Unanswered
English Spot posted this in #help-forum
Open in Discord
English SpotOP
Hello! We have 2 cronjobs that run each minute and update our Supabase.

vercel.json is attached below.

This is our cron
imports...

export const GET = async () => {
  try {
    const { data, error } = await supabase //
      .from...

    if (error) return sendBadRequest(endpoint, error.message)

    data.forEach(async (row) => {
      ...perform some updates...      

      if (error) return sendError(endpoint, error.message)
    })

    return sendSuccess({ message: 'Cron job executed!' })
  } catch (error) {
    return sendError(endpoint, error)
  }
}


For some reason a couple of days ago this stopped working. When visiting the route manually it works, but on vercel even if I click "Run" I don't see any log outputs on Vercel's logs.

sendSuccess
export const sendSuccess = (data = {}) => {
  return new NextResponse(
    JSON.stringify({
      success: true,
      ...data,
    }),
    {
      headers: { 'cache-control': 'no-cache, no-store, must-revalidate' },
      status: 200,
    },
  )
}

3 Replies

English SpotOP
Is there any chance the path needs to be app/api/cronjob/embedding ?
Have the same issue. After redeploying everything works fine
English SpotOP
I deployed a few more times but it doesnt work as well