Skip to content
Latchkey

Cloudflare Workers "Worker exceeded the size limit" in CI

Cloudflare measures the gzipped size of your uploaded Worker. The Free plan caps it at 1 MiB and paid plans at 10 MiB. When the bundle is over that, wrangler deploy fails before the script ever runs.

What this error means

wrangler deploy fails during upload with "Your Worker exceeded the size limit of 1 MiB" (Free) or 10 MiB (paid). It reports the compressed size next to the limit.

wrangler
✘ [ERROR] A request to the Cloudflare API (/accounts/.../workers/scripts/my-worker) failed.

  Your Worker exceeded the size limit of 1 MiB. [code: 10027]

Common causes

A heavy dependency is bundled into the Worker

A large library (a full SDK, a moment-with-locales, a wasm blob) is pulled into the bundle, pushing the compressed script past the limit.

Free plan 1 MiB cap on a script that needs the 10 MiB tier

The Worker is under 10 MiB but over 1 MiB, and the account or the deploy is on the Free plan where only 1 MiB is allowed.

How to fix it

Shrink the bundle

  1. Run a bundle analysis to find the largest modules in the upload.
  2. Replace heavy dependencies with lighter ones or import only the submodules you use.
  3. Enable minification so the compressed size drops.
wrangler.toml
# wrangler.toml
[build]
minify = true

Confirm the plan that the limit applies to

The 1 MiB cap is the Free plan. If the script is between 1 and 10 MiB, the deploy must target a paid plan account. Check that the CI token belongs to that account.

How to prevent it

  • Track the compressed bundle size in CI and fail early when it approaches the cap.
  • Import submodules rather than entire SDKs to keep the bundle small.
  • Move large static assets out of the script and serve them from KV, R2, or Assets.

Frequently asked questions

What causes ""Worker exceeded the size limit""?
A large library (a full SDK, a moment-with-locales, a wasm blob) is pulled into the bundle, pushing the compressed script past the limit.
How do I fix "Worker exceeded the size limit"?
Shrink the bundle

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card