Cronjobs with a POST http request method
Unanswered
Oak Titmouse posted this in #help-forum
Oak TitmouseOP
I'm currently working on an application with streaks, and I have a cronjob set up to run everyday to reset a users streak based on certain conditions. However, this requires a POST http request, and it seems that there's no way to configure Vercel to run with any method other then GET. What's the best way around this?
14 Replies
@Oak Titmouse I'm currently working on an application with streaks, and I have a cronjob set up to run everyday to reset a users streak based on certain conditions. However, this requires a POST http request, and it seems that there's no way to configure Vercel to run with any method other then GET. What's the best way around this?
github actions? run a script that makes POST request
@Oak Titmouse I'm currently working on an application with streaks, and I have a cronjob set up to run everyday to reset a users streak based on certain conditions. However, this requires a POST http request, and it seems that there's no way to configure Vercel to run with any method other then GET. What's the best way around this?
im confused, what would you like the POST to include, the users? as if so you should fetch those inside the route handler...
@riský im confused, what would you like the POST to include, the users? as if so you should fetch those inside the route handler...
Oak TitmouseOP
yeah, i have to query for the last time that they extended their streak, and based on that, i either do nothing or reset their streak by writing the changed data to the db
sorry i didn't clarify the first time around, i'm using vercel cronjob atm
so you should use GET and do the database query there
if you need some filters, you can use search params
Oak TitmouseOP
biggest problem is writing to the db, it seems like i can't do it in a GET request
why cant you?
what are you using, like there shouldnt be any diference between the 2 for database
Oak TitmouseOP
just drizzle with a neon sql db
the data wasn't getting updated when i used a get request
ah, you need to make it dynamic
for example
export const revalidate - 0(i forgot that post is oped out of cache, whereas get is cached in v14)