automationd
automationd15mo ago

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!
10 Replies
Nick
Nick15mo 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
automationd15mo 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
Nick15mo 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
automationd15mo ago
I think I'll just curl the /<route>.<query>?batch&input&from 🤔 It seems to work
Nick
Nick15mo 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
automationd15mo 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
Nick15mo ago
At this point just move off Vercel haha
automationd
automationd15mo 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
Nick15mo 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
automationd15mo 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 😂