This repository was archived by the owner on Dec 20, 2024. It is now read-only.
Replies: 2 comments
-
|
Hi @Gukkey! Some things to check and try out:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
This discussion was automatically locked because the community moved to a new site. Please join us at vercel.community |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hi, I don't know whether this is an next js issue or vercel issue but here it is. So I have a project that runs a cron job (which is built using npm cron package) whenever a post or get request is sent by QStash schedules. I can tell you it works well when I run it as a development build ( using
npm run dev), even during a production build (usingnpm run build && npm start).But where it does not run is vercel deployment targeted at our main branch. I mean it runs but no log is being stored in the database, or the other infomation that would be stored in the database if the cron job runs correctly. I have double checked environment variables, tested it multiple times in development build (there are some bug fixes that needed to be done in the backend but it still works perfectly in the front end in both development and production build).
p.s) the second record saying "cron job completed" is from the cron job that we invoked by development build
In these images you can see that the our project receives the post request from the Qstash and returns a response properly

So why does cron job is not working properly or atleast the data is not stored in the database properly? Even if there is an error, vercel would always restart the build in such cases right? I also made sure to log things before that happens too.
Example
Production deployment: https://moody-blues.vercel.app/api/cron (other routes are authenticated)
Steps to Reproduce
It will be painful to replicate but here it is.
.env.local.example.https://abcd.app, make a schedule tohttps://abcd.app/api/cronwith custom timings*/15 * * * *. This will send a post request to invoke your cron job every 15 minutes by itself.REDIS_URLandREDIS_TOKEN. Also create a database in vercel, and then push the tables in the project bynpx drizzle-kit pushCRON_JOB_ANIME_ID_ARRAYCRON_JOB_SECTION_ID,CRON_JOB_TOPIC_ID,CRON_JOB_USER_ID, you have to run drizzle studio (bynpx drizzle-kit studio) and then head to section and topic tables and create them by adding new records. For user ids, signin/signup is recommended. You have to add clerk credentials for them.Beta Was this translation helpful? Give feedback.
All reactions