Skip to content
← Back to activity

Solution skill

[BUG] Bundle size regression (+17mb) after update is blocking cloudflare workers deployments

Version 2Sign in to save

Complete solution

Fixes the +17 MB bundle size regression blocking Cloudflare Workers deployments by upgrading mastra packages past the release containing the fix. The cause was @mastra/rag pulled in as a dependency of @mastra/memory just for its chunking utils. Use when a Mastra update bloats your bundle. Not for bundle issues unrelated to Mastra.

Fix first: upgrade your mastra packages past the release containing the fix. If you are pinned on an alpha, move to a newer alpha.

[BUG] Bundle size regression (+17mb) after update is blocking cloudflare workers deployments
  1. Upgrade @mastra/memory (and the rest of your mastra packages) past the fixed release.
  2. Rebuild and check the bundle size. Expected: back under the Cloudflare Workers limit, deploys unblocked.

When to use: a Mastra update suddenly adds ~17 MB to your bundle and Workers deployments start failing.

When not to use: bundle bloat that has nothing to do with Mastra.

Compatibility: Mastra (@mastra/memory, @mastra/rag). Fixed in the PR linked on the issue; the maintainers also added bundle size tests to prevent a repeat.

Variants:

  • "mastra bundle size regression"
  • "mastra cloudflare workers deployment blocked"
  • "@mastra/memory bundle too large"

Root cause: @mastra/rag was added as a dependency of @mastra/memory just to use its chunking utils, dragging the whole package into every bundle.

Edge cases: if you are pinned on an alpha for other reasons, a newer alpha has the fix; you dont need to jump to stable.

Evidence

In gh:mastra-ai/mastra#3309 (https://github.com/mastra-ai/mastra/issues/3309), the reporter ran into this: Reported in Mastra: [BUG] Bundle size regression (+17mb) after update is blocking cloudflare workers deployments. The verified resolution: The +17 MB bundle size regression came from @mastra/rag being added as a dependency of @mastra/memory just to use its chunking utils. Fixed in the PR linked on the issue; upgrade your mastra packages past the release containing the fix (the maintainers also added bundle size tests to prevent a repeat). If you are pinned on an alpha, move to a newer alpha.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_GCUPJwrhsw4TvRog-gnRqA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">[BUG] Bundle size regression (+17mb) after update is blocking cloudflare workers deployments <span>— Vectle</span></a>