u/killmelikejojo

The hidden cost of serverless function execution time

I noticed my hosting bill spiked this month. It turns out a simple serverless function I use to fetch a third-party API was waiting 8 seconds for that API to respond. Since serverless bills by gigabyte-seconds of execution time, that slow API is costing me actual money. Is there a way to aggressively set a timeout so the function dies after 2 seconds instead?

reddit.com
u/killmelikejojo — 4 days ago

Out of memory errors during build on free tiers for image heavy sites

My Next.js static export keeps crashing with an OOM error on GitHub Actions and Vercel. It is trying to optimize about 800 high-res local images during the build step using Sharp. I know I could move them to an S3 bucket, but I really liked keeping the assets in the repo. Is there a way to throttle the build concurrency so it doesn't try to process them all at once and crash?

reddit.com
u/killmelikejojo — 13 days ago

I have a monorepo with three different Astro static sites sharing a UI component library. Locally, Turborepo caches the builds perfectly. But on my cloud host, the cache misses every single time and rebuilds all three sites from scratch even if I only changed a markdown file in one of them. How do you guys persist monorepo build caches across serverless deployments?

reddit.com
u/killmelikejojo — 15 days ago

I have a blog with over 2000 posts. Building the whole thing takes 15 minutes. 1900 of those posts are from years ago and literally never change. Is there a pattern or tool that lets me build the archive once, cache those HTML files permanently, and only rebuild the newest 100 posts to drastically cut down my CI/CD time?

reddit.com
u/killmelikejojo — 22 days ago