Vercel cron for Postgres Backup
Unanswered
Kerry Blue Terrier posted this in #help-forum
Kerry Blue TerrierOP
Is there an example of how to use Vercel cron for Vercel postgres db backup?
6 Replies
@Kerry Blue Terrier Is there an example of how to use Vercel cron for Vercel postgres db backup?
Vercel cron is just calling your own endpoint. What you do inside it, can be different for each case. So create a cron job like this and add your stuff inside your api endpoint: https://vercel.com/guides/how-to-setup-cron-jobs-on-vercel
Kerry Blue TerrierOP
i understand that, I am wondering if anyone has a working example of this so i dont have to write from scratch. I would imagine almost everyone who is using vercel postgres needs this as it does not provide automatic backups. (fyi, i also asked claude 3.5 and gpt 4o to write such a function and didnt work correctly using vercel postgres sdk).
@Kerry Blue Terrier i understand that, I am wondering if anyone has a working example of this so i dont have to write from scratch. I would imagine almost everyone who is using vercel postgres needs this as it does not provide automatic backups. (fyi, i also asked claude 3.5 and gpt 4o to write such a function and didnt work correctly using vercel postgres sdk).
Ah ok. Use this as your
And this inside your
vercel.json:{
"crons": [
{
"path": "/api/cron",
"schedule": "0 5 * * *" // job is scheduled to execute every day at 5:00 am UTC
}
]
}And this inside your
route.ts in (api/cron):export async function GET(request: Request) {
// do your backup. Depends on your backend
}@Kerry Blue Terrier do you need anything else?
@Kerry Blue Terrier ?
Peruvian anchoveta
Can we use vercel cron to dispatch redux action?