Ability to perform a tRPC request form a terminal, curl-like

Hey, I wanted to ask if there is conventional a way to do that? I wanted to warmup my lambda but can't find a dead-simple way to stick this into a cron. TY!
Nick
Nick•375d ago
What are you trying to achieve? My API has a warmup endpoint which the frontend calls on page open before any bigger calls are required, so the UI can present a warmup spinner If you want your API perpetually warm though, lambda has a provisioned capacity you can set to do this
automationd
automationd•375d ago
Hey Nick, I want to call a tRCP endpoint to warm it up. It's on Vercel, let's say. I want this function to be always warm there, so have a cron job to call it ever x minutes I see what you mean with the warmup on the frontend side, it could work yeah.
Nick
Nick•375d ago
In general, best to let it scale to 0 if there's no dedicated capacity controls Focus on optimising cold boots in my opinion But you could could the tRPC client with a little node.js script to hit a healthcheck endpoint if you like
automationd
automationd•375d ago
I think I'll just curl the /<route>.<query>?batch&input&from 🤔 It seems to work
Nick
Nick•375d ago
Yeah doesn't even have to be a valid URL probably! With the way serverless creates new instances during surges in loads, you're probably not going to avoid cold boots is all. The first few users might benefit but everyone else will eventually get a slow response
automationd
automationd•375d ago
public endpoint seems to works fine with a regular curl, at least locally
With the way serverless creates new instances during surges in loads, you're probably not going to avoid cold boots is all. The first few users might benefit but everyone else will eventually get a slow response
That's true. Unless I know how many users I need and pre-scale it that way.
Nick
Nick•375d ago
At this point just move off Vercel haha
automationd
automationd•375d ago
yeah What I want at this stage is that those 5 users hitting my app to be happy hehe so the answer would be to run a get request towards an endpoint in a right format
Nick
Nick•375d ago
I've heard good noises around this for people who find serverless isn't right for them but want simple https://www.flightcontrol.dev/
Flightcontrol — AWS Without Pain
AWS Without Pain. Deploy, preview, & scale. DevOps not required. By the team behind Blitz.js
automationd
automationd•375d ago
Thank you! I don't mind running my own k8s cluster, I'm from OPS. What I want is to bridge the gap between Vercel and AWS, and for now I'm solving the Vercel part, since a lot of people start using it and getting thrown away by cold starts TBH, I don't like super hard wrappers like this around cloud. They create some "false control percepton" I could be wrong though hehe Thanks again Nick I'll probably continue asking stupid questions on this discord 😂
More Posts
Usage of useQuery after pageload?Hi all! I am new to TRPC so my apologies in advance for a very nooby question: In my [id].tsx file ISecurity question about tRCPIf I export the tRCP router as type in order to import that type in my client JS, wouldn't it mean tReal-world Large Application Examples?Are there any OSS examples (besides cal.com) demonstrating large tRPC code bases? I want to see howScaling tRPCI’ve been seeing issues regarding tRPC routers and performance issues as routers grow. I’m wonderinwhat is the best way to update trpc and its dependencies?Hi all, as the title says, how can i best update trpc and its dependencies? TRPC stands at 10.25.1,Where i can read a journal about tRPC ?I use tRPC for my Final Task in my Bachelor Degree, but i can't found journal about tRPC. Can anyoneDefault Query Function to resume paused mutationsI'm building a React Native App with an offline mode. I implemented a PersistQueryProvider and a buiSuperJSON is wrapping results in type with keys "json" and "meta"How can I modify the transformer in SuperJSON library to only return the "json" property and ignore Caching(?) previous data until query returns new datawhen I update my useQuery inputs with new filters it instantly sets the data to `undefined` while thHow to upload file not use S3 Next js? Please, examplefile: course.router.ts / import { CourseSchema } from "~/schema/post.schema"; import { createTRPChow can i send a request to specific route in trpc server, after mutation ?i am using trpc with next js ,Help in deploymentHey all, I am building an app which is having a 1 . vite-react frontend 2 . trpc-standalone how to persist the query client?I want to persist the trpc query client cache, but don't want to create a new query client, I want tHow to infer type of a nested object from app router output?I have a tRPC router than returns a nested object through a db query. It looks like this: ```ts ILeWhat's the type of errorFormatter parameterI wanna know how could i get the type of the errorFormatter parameter, so i can move the errorFormattRPC works only for monoliths environment?How can I works if typesafe in real time with a remote server? 🤔How to use createCaller() with lambda for testing?Has anyone successfully mocked a trpc caller that uses the AWS Lambda integration? trying to write sis there a way to call useQuery() from a callback and get the return value within that callback?I have a generic component that is effectively an autocomplete that fills in options from a web requUsing Response with the Next App RouterThe route handlers in the App Router, only receive the Request object, requiring you to use a ResponThe only way to access useQuery options without input is passing undefined to it?Is there any other way? seems strange pass undefined to the input query