Vercel Timeouts πΆπ« What can I do if I need longer server functions?
I have some tRPC mutations that take over 10 seconds and closer to 1 minute to complete. Currently they are getting timed out by Vercel. I can see that I can buy a Team plan but that isn't favorable.
What are your recommendations? How do you deal with this?
15 Replies
Host on AWS, afaik it's a 10 minute execution limit
Or run it as a node server
Use a message queue or something
1 minute is not a reasonable time for a normal req/res
Seconding this; if you really canβt do better response timings, QStash with a callback could help you (https://docs.upstash.com/qstash/features/callbacks)
Does Tho have any good videos on message queue? Or any you would recommend?
Looking into QStash callbacks they seem to be good if I am calling another API that takes a long time. The issue I have is that a function in my backend is taking a long time.
Correct me if I am wrong, this is the first time looking into these.
On another side note I will be doing some web scraping soon that will occur on a per request basis. Any advice related to this? I have tried but run into the same issue as the scraper takes longer than 10 seconds. Maybe for the web scraping I will move it to Digital Ocean
Sorry I assumed it was caused by a response you were waiting from a
fetch
or something (your comprehension of QStash is correct). An AWS lambda function as suggested by @benten is probably your best bet thenUse a stateful server for this, no reason it needs to be a lambda.
Or use AWS
@Migu I was hosting on Railway for a while and I think under the hood they use AWS lambda and I was having issues doing web scraping.
@benten stateful server as in a Digital ocean droplet?
A server that runs continuously
Any recommendations?
DO is good, same with railway
Really appreciate the advice π
heck even EC2 is fine lol
if you do this please make sure you follow whatever robots.txt rules that website might have - be a good netizen π
Got curious and started looking up robots.txt on various websites, came across this on discord π€£
this might be a bit reductive, but also take a look at the code in your function and see if it can be optimized. I had this issue last week, but introducing parallel async/awaits in my code solved the problem without needing to use any additional or external services.