[Solved] How to use Vercel Cron Job with T3?

Hey! I am using T3. I am new with TRPC and don't know how to handle Vercel Cron Job. I want to add some data to the database everyday. How do I do that?
6 Replies
barry
barry2y ago
Vercel Documentation
Cron Jobs
Learn how to schedule your Serverless and Edge Functions with Cron Jobs.
barry
barry2y ago
vercel.json
{
"crons": [
{
"path": "/api/cron/dailydb",
"schedule": "0 0 * * *"
}
]
}
{
"crons": [
{
"path": "/api/cron/dailydb",
"schedule": "0 0 * * *"
}
]
}
Should be once a day I would probably make my own normal api handle with Next like this
api/
cron/
dailydb.ts
api/
cron/
dailydb.ts
Then in dailydb I would just use a caller from trpc to call the trpc procedure https://trpc.io/docs/server/server-side-calls
albatroz
albatroz2y ago
if you are using hobby version of vercel, it will be only triggered in prod env. i use serverlessQ
Nemila
NemilaOP2y ago
@barry got it thank you It does Cron jobs too?
albatroz
albatroz2y ago
yes, Vercel has many plugins; serverlessQ is one of them
Nemila
NemilaOP2y ago
Gotcha thx
Want results from more Discord servers?
Add your server