Memory Leaks and Production Nightmares
Our e-commerce site (14,000 product pages from Contentful + 2,400 Shopify products) runs on Gatsby 5.12.0. Started noticing weird shit around October 2024 when our Senior Frontend Dev Jake upgraded from 5.8.0. Builds would randomly fail at step "Building static HTML for pages" with:
<--- Last few GCs --->
[23847:0x5555e8b6c000] 185623 ms: Mark-Sweep 2048.0 (2070.8) -> 2048.0 (2070.8) MB, 1049.2 / 0.0 ms (average mu = 0.136, current mu = 0.000) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
Documentation says set NODE_OPTIONS="--max_old_space_size=8192"
. We tried 4GB, 8GB, 16GB on our GitHub Actions runners (Standard_DS3_v2). Still crashes around page 8,127 every fucking time. Something's leaking during SSR but the Gatsby team won't respond to the GitHub issue we opened eight months ago. Our DevOps team is livid about the wasted CI minutes.
The official Gatsby docs acknowledge the problem but offer no real solutions. Community threads are full of people hitting the same wall. Even Netlify's forums show builds failing with exit code 137.
The Shopify Time Bomb
Worse problem: gatsby-source-shopify
is about to break. Plugin uses Shopify Admin API version 2024-01, which gets deprecated January 1, 2025. New version 2024-07 has breaking changes to product variants schema.
The plugin hasn't been updated since March 2024. Last maintainer left after Netlify layoffs. No one's fixing it. The npm package shows 10,000+ weekly downloads but zero maintenance. Plugin repository issues keep piling up with no responses.
Our entire product catalog (2,400 products across 8 categories) will go dark in 22 days. Had to fork the plugin and patch it ourselves. Spent 3 days with Sarah from the backend team figuring out the new GraphQL schema just to keep builds working. Management still doesn't understand this is a P0 issue. Shopify's API versioning docs show the deprecation timeline. Other devs are reporting the same panic across forums.
Build Performance Death Spiral
Started at 6 minutes 23 seconds in August 2022 with 8,000 pages. Now 47 minutes 12 seconds with 14,000 pages on identical hardware. That's not linear scaling - something's completely fucked in gatsby-node.js
.
I profiled it with npx --node-options="--inspect" gatsby build
and watched Chrome DevTools. Memory usage climbs from 412MB to 6.8GB during "source and transform nodes". Never comes down. Garbage collection runs every 28-35 seconds but only frees 180-280MB. The memory leak is real. Memory profiling guides show the same pattern. Performance optimization docs are outdated.
Compare that to our Next.js test branch: 4 minutes for the same content. No memory issues. Next.js build performance is consistently faster. Framework benchmarks confirm the difference. But migration means rewriting 47 GraphQL queries and our entire image handling pipeline. Migration guides exist but they're not comprehensive.