Skip to content
Content
Skill

/api-bundle-size-limit

Covers how to configure the maximum allowed size of the Webiny API Lambda bundle using the Infra.Api.MaxBundleSize extension in webiny.config.tsx. Use when a project's API bundle exceeds the default 4.5 MB limit or when you want to enforce a stricter limit. Handles the extension

From plugin
webiny-js
8.1k78 skills3 MCP

Claude Code

$ npx -y skills add webiny/webiny-js --skill api-bundle-size-limit --agent claude-code

SKILL.md

api-bundle-size-limit.SKILL.md
name: api-bundle-size-limit
description: >
  Covers how to configure the maximum allowed size of the Webiny API Lambda
  bundle using the Infra.Api.MaxBundleSize extension in webiny.config.tsx.
  Use when a project's API bundle exceeds the default 4.5 MB limit or when
  you want to enforce a stricter limit. Handles the extension syntax, byte
  calculations, and interpreting the build error message.

API Bundle Size Limit

TL;DR

The `Infra.Api.MaxBundleSize` extension enforces a maximum size on the built API Lambda bundle. The default limit is 4.5 MB. If the bundle exceeds the limit the build fails with a clear error; add the extension to `webiny.config.tsx` to raise (or lower) it.

Default Behavior

By default Webiny enforces a **4.5 MB** limit on the API Lambda bundle (`handler.mjs`). If the built output exceeds this, the build fails:

error   Build errors:
× asset size limit: The following asset(s) exceed the recommended size limit (4.5 MiB).
× entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (4.5 MiB).
error   build failed

Raising the Limit

Add `Infra.Api.MaxBundleSize` to `webiny.config.tsx` with `size` in **bytes**:

// webiny.config.tsx
import { Infra } from "webiny/extensions";

export const Extensions = () => (
  <>
    {/* Raise the API bundle size limit to 6 MB */}
    <Infra.Api.MaxBundleSize size={6 * 1024 * 1024} />
  </>
);

Common byte values:

| MB | Bytes expression | Exact bytes | | --- | ------------------------------- | ----------------- | | 4.5 | `Math.round(4.5 * 1024 * 1024)` | 4718592 (default) | | 5 | `5 * 1024 * 1024` | 5242880 | | 6 | `6 * 1024 * 1024` | 6291456 | | 8 | `8 * 1024 * 1024` | 8388608 | | 10 | `10 * 1024 * 1024` | 10485760 |

How It Works

The extension sets the `WEBINY_INFRA_API_MAX_BUNDLE_SIZE` environment variable (in bytes) which is read by the API bundler (`@webiny/build-tools`) at build time. The `WEBINY_INFRA_` prefix ensures the variable is **not** automatically forwarded to the Lambda function's runtime environment.

Lowering the Limit

You can also enforce a stricter limit to catch bundle regressions early:

{
  /* Enforce a strict 3 MB limit */
}
<Infra.Api.MaxBundleSize size={3 * 1024 * 1024} />;

Quick Reference

| Task | Snippet | | ------------------------ | ----------------------------------------------------- | | Raise to 6 MB | `<Infra.Api.MaxBundleSize size={6 * 1024 * 1024} />` | | Raise to 10 MB | `<Infra.Api.MaxBundleSize size={10 * 1024 * 1024} />` | | Restore default (4.5 MB) | Remove the extension | | Convert MB to bytes | `Math.round(N * 1024 * 1024)` |

Related Skills

  • `infra-env-var` -- setting arbitrary environment variables in the project context
  • `api-lambda-function` -- adding custom Lambda functions to the API
Read more
@webiny
Ships withwebiny-js

Open-source content platform. Self-hosted on AWS serverless. Built as a TypeScript framework you extend with code, not a closed product you configure through a UI. Runs on Lambda, DynamoDB, S3, and CloudFront inside your own AWS account. Scales automatically.

8.1k78 skills3 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
8.1k
Star history of webiny/webiny-js on GitHub, a chart by star-history.com

Other skills on webiny-js.

design-ask

design-ask

Turn open design questions into a paste-ready prompt for Claude Design, log them with Q-IDs and copy the prompt to the clipboard.…

@webiny@webinyInstall Skill
design-pull

design-pull

Pull a Claude Design project into a local, git-ignored design folder and keep a catalogue of what was pulled and implemented. Use…

@webiny@webinyInstall Skill
grill-me

grill-me

Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision…

@webiny@webinyInstall Skill
prd-to-plan

prd-to-plan

Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in…

@webiny@webinyInstall Skill
preflight

preflight

Webiny-only. Run all checks required before packages are ready for publish: deps, build, lint, format, tests.

@webiny@webinyInstall Skill
tester

tester

Use when running tests. Shows how to run tests for a single package, including OpenSearch (ddb-os) tests when applicable.

@webiny@webinyInstall Skill

More skills from other plugins.

prompt-lookup

prompt-lookup

Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use…

@gh-f@gh-fInstall Skill
ppt-master

ppt-master

AI-driven presentation workflow for generating editable PPTX decks and slides, reconstructing page visuals, creating reusable…

@hugohe3@hugohe3Install Skill
morph-ppt

morph-ppt

Use this skill when the user wants a .pptx with smooth cross-slide animation — PowerPoint Morph transitions, Keynote-style…

@iofficeai@iofficeaiInstall Skill

Questions about api-bundle-size-limit.

Which coding agents can use api-bundle-size-limit?
api-bundle-size-limit installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.