Call tRPC from the Next.js API folder
I'm working on calling an event that deletes old files when calld from a github actions cron job.
this is the code:
it keeps giving me this problem at deleteOldTracks: This expression is not callable.
any suggestions on a fix?
4 Replies
what i learnt from the other day
https://trpc.io/docs/server-side-calls
Server Side Calls | tRPC
You may need to call your procedure(s) directly from the server, createCaller() function returns you an instance of RouterCaller able to execute queries and mutations.
api
doesnt exist in the backend
you can use callers, but depending on your exact use case theres a good chance its better to just extract a function and call thatChristopher Ehrlich
YouTube
Advanced tRPC - Callers, functions, and gSSP
Repo for this video: https://github.com/c-ehrlich/you-dont-need-callers
If you want to use schema in the frontend, they cannot be imported from the same file as things that run specifically in the backend. One solution would be to put them into a
procedureName.schema.ts
or similar file.
tRPC:
https://trpc.io/docs
Create T3 App:
https://crea...oh thanks for the help 😄