Zum Inhalt springen
Skillpedia
APIs & Server (Backend)8.1k · #12581

api-bundle-size-limit

Was er macht

Diese Fähigkeit hilft deiner KI, das Größenlimit des Webiny-API-Builds zu ändern. Sie ist für Entwickler gedacht, deren API-Build fehlschlägt, weil das Paket größer ist als das Standardlimit.

Wann du ihn nutzt

  • ✓Wenn dein Webiny-API-Build mit einem Fehler zur Größe von Assets fehlschlägt.
  • ✓Wenn dein API-Paket größer als das Standardlimit von 4,5 MB ist.
  • ✓Wenn du ein strengeres Größenlimit für das API-Paket durchsetzen willst.

Link zum Skill

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api-bundle-size-limit/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api-bundle-size-limit/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Mein Webiny-Build schlägt mit einem Fehler zur Asset-Größe fehl. Erhöhe das API-Paketlimit auf 6 MB.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Die Fähigkeit zeigt, wie man eine Einstellung in der webiny-Konfigurationsdatei ergänzt, wobei die Größe in Bytes angegeben wird. Sie erklärt außerdem, wie man die Fehlermeldung des Builds liest.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von 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 context
  • api-lambda-function -- adding custom Lambda functions to the API
Häufige Fragen

Wie hoch ist das Standardlimit?

Das Standardlimit für das Lambda-Paket der API beträgt 4,5 MB.

Welche Einheit nutzt die Einstellung?

Sie nutzt Bytes, daher werden 6 MB als 6 mal 1024 mal 1024 geschrieben.

Kann ich das Limit verschärfen?

Ja. Laut der Fähigkeit kannst du ein niedrigeres Limit setzen, um eine strengere Größe durchzusetzen.

Details

Originalbeschreibung des Autors

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

Beliebtheit

GitHub-Sterne
8.1k
Platz im Ranking
#12581
Lizenz
—
Aktualisiert
2.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills