TraceResolveSRE Platform
MCP ServerAdmin
Back to CatalogCloudflare Workers

Cloudflare Workers: Script size exceeds worker limit (1MB uncompressed / 10MB)

Error: Script size 1.4 MB exceeds the maximum size allowed for free/standard plan workers (1048576 bytes).
Immediate Remediation
bash
# 1. In wrangler.toml: Enable bundle minification
minify = true

# 2. Exclude heavy node built-ins and inspect bundle size:
npx esbuild src/index.ts --bundle --minify --platform=neutral --outfile=dist/worker.js --analyze
Root Cause Analysis

The worker bundle bundled large dependencies (e.g. AWS SDK, full Lodash, or Prisma engine) exceeding the Cloudflare Edge Worker bundle limit.

Verification & Guardrails

  • Use modular imports: import { S3Client } from "@aws-sdk/client-s3" instead of importing full AWS SDK.
  • Upgrade to Workers Paid for up to 10MB compressed bundle headroom.

Have a custom or uncategorized crash?

Run your trace through our in-memory client privacy sandbox for instant SRE remediation.

Open Diagnostic Studio