Cron job has some db update/create features in it - it only work when i deploy a change
Unanswered
Tornjak posted this in #help-forum
TornjakOP
I have a cron running every 10 minutes and vercel is happy with that, it runs every 10 minutes. The problem is, the action inside the cron only tends to run when i commit a change to it.
This is my cron for example, it runs every minute and should just update the name of a user to the current time.
As you can see from the screenshots its running every minute, but the last update was the last time i changed the code.
This is my cron for example, it runs every minute and should just update the name of a user to the current time.
As you can see from the screenshots its running every minute, but the last update was the last time i changed the code.
import type { NextApiRequest, NextApiResponse } from "next";
import { NextResponse } from "next/server";
import { db, eq } from "@acme/db";
import { users } from "@acme/db/auth";
export async function GET(_req: NextApiRequest, _res: NextApiResponse) {
await db
.update(users)
.set({ name: new Date().toLocaleTimeString() })
.where(eq(users.id, "004a1efc-e911-4da5-a881-d78fa17dd517"));
return NextResponse.json({ status: "ok" });
}