api-bundle-size-limit
What it does
This skill helps your AI change the size limit on the Webiny API build. It is for developers whose API build fails because the bundle is larger than the default limit.
When to use it
- ✓When your Webiny API build fails with an asset size limit error.
- ✓When your API bundle is larger than the default 4.5 MB limit.
- ✓When you want a stricter size limit enforced on the API bundle.
Skill link
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api-bundle-size-limit/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“My Webiny build fails with an asset size limit error. Raise the API bundle limit to 6 MB.”
5 new skills a week. 1 minute to read.
How it works
The skill shows how to add a setting in the Webiny configuration file, with the size written in bytes. It also explains how to read the build error message.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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 contextapi-lambda-function-- adding custom Lambda functions to the API
FAQ
What is the default limit?
The default limit for the API Lambda bundle is 4.5 MB.
What unit does the setting use?
It uses bytes, so 6 MB is written as 6 times 1024 times 1024.
Can I make the limit stricter?
Yes. The skill says you can set a lower limit to enforce a stricter size.
Details
Original description by the author
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.
repo: webiny/webiny-js
Popularity
- GitHub stars
- 8.1k
- Ranking position
- #12581
- License
- —
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
prd-to-plan
8.1kHelps your agent turn a product requirements document into a phased plan of small end-to-end slices, saved as a Markdown file.
webiny-admin-architect
8.1kTeaches your agent how to build admin screens for the Webiny platform, using its business logic layers and presenter pattern.
webiny-admin-permissions
8.1kTeaches your agent to add permission controls to Webiny admin screens, including auto-generated permission forms and hide-or-show checks.
webiny-form-model
8.1kTeaches your agent to build forms in Webiny using a declarative field builder, layouts, validation and conditional rules.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.