Migrating 332,000+ Next.js 16 SSR Pages From Cloud Run to Cloudflare Workers: Cutting 16.5 GB/Day Egress & Fixing Error 1102
Running a 45-language Next.js 16 encyclopedia with 7,416+ PC games, 632+ official FLiNG trainers, and 70,000+ walkthrough chapter pages on GCP Cloud Run looks cheap until residential botnets hit 500,000 requests/day—burning 16.5 GB/day of container egress.
Here is how we migrated RepackDeck onto @opennextjs/cloudflare Cloudflare Workers with 0 Cloud Run invocations, $0/month GCP egress, and 100/100 Desktop & Mobile PageSpeed—plus how we fixed Cloudflare Error 1102 (exceededCpu) under 25,000-page SEO crawls.
1. Zero-Copy DecompressionStream("gzip") for Sitemaps & Catalog APIs
Parsing and re-stringifying a 3.16 MiB 7,416-item JSON index inside a Worker isolate burns 25–45 ms of V8 CPU and causes instant Error 1102 on cold starts.
- Fix: Pre-bake
/_catalogue/catalog-index-api.json.gzand all 9 XML sitemaps at build time intoenv.ASSETS, then pipe them straight throughassetResp.body.pipeThrough(new DecompressionStream("gzip")). - Result:
/api/catalog?action=indexstreams3.3 MiBof JSON at2 msCPU and< 1 MiBRAM, powering instant client filtering across PC Game Trainers and 100% Campaign Walkthroughs.
2. Indexed Supabase Slices Instead of Full-Index Isolate Parses
Rather than parsing 7,416 rows on every /company/*, /tag/*, /category/*, or /release/* SSR hit, we hydrate a tiny 57 KiB catalog-top.json (top 120 games) and query Supabase PostgREST with Prefer: count=exact (limit=60, ~18 KiB JSON) for filtered hubs—dropping isolate CPU by >90% while preserving exact full-catalog counts.
3. Protecting Adsterra Revenue & Crawler Access at the Edge
- Never cache dynamic
/ads/*at Cloudflare Edge: Bot visits return emptyprivate, no-storeHTML (Vary: User-Agent) while humans receive live ad units (private, max-age=60). Bypassing/ads/*in Cloudflare Cache Rules permanently eliminates bot-empty cache poisoning. - Scope Free/Pro rate limits strictly to
/api/*: Blanket HTML rate limits (45 reqs/10s) accidentally429-block Googlebot and SeobilityBot when edge TTFB drops to 20 ms. - Explore the live benchmarks: Repack Compression Ratios | ISDone.dll & Unarc.dll Error Solver | Steam Deck Proton GE Repacks.