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
benten
bentenβ€’2y ago
Host on AWS, afaik it's a 10 minute execution limit Or run it as a node server
cje
cjeβ€’2y ago
Use a message queue or something 1 minute is not a reasonable time for a normal req/res
Migu
Miguβ€’2y ago
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)
Lukem121
Lukem121OPβ€’2y ago
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
Migu
Miguβ€’2y ago
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 then
benten
bentenβ€’2y ago
Use a stateful server for this, no reason it needs to be a lambda. Or use AWS
Lukem121
Lukem121OPβ€’2y ago
@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?
benten
bentenβ€’2y ago
A server that runs continuously
Lukem121
Lukem121OPβ€’2y ago
Any recommendations?
benten
bentenβ€’2y ago
DO is good, same with railway
Lukem121
Lukem121OPβ€’2y ago
Really appreciate the advice πŸ™
Zero
Zeroβ€’2y ago
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 πŸ™‚
Pod
Podβ€’2y ago
Got curious and started looking up robots.txt on various websites, came across this on discord 🀣
JessesBeetShoppe
JessesBeetShoppeβ€’2y ago
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.
ethan
ethanβ€’2y ago
I recommend https://fly.io. they have a generous free tier that will likely cover your needs.
Want results from more Discord servers?
Add your server