Mike Shoebox ๐Ÿ”œ MIXTRESS at RECON Profile picture
Full-stack dev. Zero work life balance. Music nerd. Builder. My projects: @labelgrid @promoly @plushrecs @section8recs @dnbradio et al.

Apr 5, 2023, 11 tweets

Attention Vercel users. Be careful what you test or deploy to Vercel. I decided to try out Vercel on a new project -- a very basic Astro deployment with a few pages, but a small mistake in our code caused us a $3000 bill in just 6 hours! ๐Ÿงต

Vercel said it was a "runaway process" or uncaught exception in our code which caused subsequent failures (costing $500 per hour). I had no idea the bill was continuously growing this fast and this could have easily cost me $30k in a few days if I didn't notice it.

This was just a test project and not open to the public. It was the first time I used Vercel and wanted to simply try out their CICD. This same code did not cause this kind of usage deployed to AWS.

Vercel wouldnt forgive the bill. I'm under the impression that I stupidly tried to force Prisma to work on Vercel or I had some uncaught exception that caused serverless function timeouts. Easy mistake to make! On the surface our code does not have any indication of recursion.

The other mistake was perhaps related to trying to implement tRPC incorrectly. We should have used router.createCaller as a server to server operation instead of using the client implementation. However I think the culprit is just the lack of a catch block on the fetch request.

However this still does not explain why there are 500k requests, or runaway recurring usage on brand new project that should be getting 0 traffic. At most the issues would be a long running query or slow cold start or something like that or perhaps a timeout connecting to mysql.

Vercel says these types of issues can happen on their serverless arch because there are no limits, making runaway usage like this very possible, but also the fault of the developer who decided to deploy their code to Vercel.

To be fair, I did get alarms from Vercel while on the Hobby plan. I simply shouldnt have upgraded to Pro without understanding what was happening first. I only upgraded so I could continue my testing. I didn't know it was costing that much.

I would say, I want to continue using Vercel. I mean, it looks awesome, but if a small mistake can cause this kind of issue, there's no way I'll go back. I mean, I'm still not 100% sure what the problem was so how can I confidently use Vercel for CICD going forward?

Anyway, I hope this helps other people avoid the same mistakes I made. I guess just be very careful when using novel packages on serverless arch. Do not push code that has mistakes to Vercel?? Do not put untested code on a Pro plan. Or just don't use Vercel.

As for me, I've moved the project to AWS using SST to deploy it, and things are working just fine. It's a project for a 501c3 nonprofit which has free AWS credits, and so far I've not seen the same issues I saw on Vercel. Thanks for reading! ๐Ÿ‘ โœŒ๏ธ

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling