zrilman
zrilman2y ago

Using tRPC in CRON jobs

Hey everyone, this might be a very stupid question, but is it possible to use tRPC inside a CRON job? I saw that Vercel now supports them, and since I use tRPC inside a NextJS project, I thought that it could be used. Unfortunately, I wasn't able to find anything online.
2 Replies
Nick
Nick2y ago
Do you mean call a tRPC API from a CRON job? If the job can run JS, then you just have a simple program which when started creates a tRPC client and calls the API
zrilman
zrilman2y ago
Yes. Exactly. Since Vercel allows ts & js cron jobs a simple vanilla client should do the work? https://trpc.io/docs/vanilla
Vanilla client | tRPC
The magic of tRPC is making strongly typed API calls without relying on code generation. With full-stack TypeScript projects, you can directly import types from the server into the client! This is a vital part of how tRPC works.