docs: clarify edge function deployment size limits (5MB server-side vs 20MB local) (#47941)

<!-- ccr-slack-attribution -->
_Requested by **Lakshan Perera** · [Slack
thread](https://supabase.slack.com/archives/C023E4L60R3/p1784055775538959?thread_ts=1784055775.538959&cid=C023E4L60R3)_

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Docs update.

## What is the current behavior?

Both the "Edge Function bundle size issues" troubleshooting page and the
Edge Functions "Limits" page stated only a single **20 MB** limit. In
practice, that 20 MB figure applies only to **local bundling** with the
Supabase CLI. When a function is deployed via the **Management API or
Dashboard**, bundling runs server-side and is capped at **5 MB** due to
an infrastructure (Lambda) limit. Customers deploying that way were
surprised to hit an error like `Function source code exceeds the maximum
deployment size (5 MB). Reduce the size of your function and try again.`
even though the docs implied 20 MB was available.

## What is the new behavior?

Both pages now state the distinction explicitly:

- **Local bundling (Supabase CLI):** up to **20 MB**.
- **Server-side bundling (Management API or Dashboard):** up to **5
MB**.

The troubleshooting page also adds a "Deploying larger functions"
section pointing customers at the workaround: if a function is under 20
MB but over the 5 MB server-side limit, bundle it locally by running
`supabase functions deploy` with the `--use-docker` flag to force local
bundling and get the higher limit.

## Additional context

**How / files changed:**

-
`apps/docs/content/troubleshooting/edge-function-bundle-size-issues.mdx`
— rewrote the intro to describe both limits, added the "Deploying larger
functions" workaround section, and fixed the frontmatter `keywords`
(replaced `"10MB"` with `"5MB"` and `"20MB"`).
- `apps/docs/content/guides/functions/limits.mdx` — updated the "Maximum
Function Size" line to list both the 20 MB local and 5 MB server-side
limits.

Before, both pages said only 20 MB, so customers deploying via the
API/Dashboard were surprised by a 5 MB error; after, both pages state
the 5 MB server-side vs 20 MB local distinction and point to local
bundling as the workaround.

---
_Generated by [Claude
Code](https://claude.ai/code/session_019bBXmQTRBWJbo3UTpfjPLU)_

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
claude[bot]andClaude authored and GitHub committed 2026-07-15 06:54:19 -06:00
1 parent 13330e6328
commit c1bd941598
2 files changed
+12 -3

No files matched your search

@@ -17,7 +17,7 @@ subtitle: "Limits applied Edge Functions in Supabase's hosted platform."
## Platform limits
- Maximum Function Size: 20MB (After bundling using CLI)
- Maximum Function Size: 20MB (bundled locally via the CLI) or 5MB (bundled server-side, e.g. via the Management API or Dashboard)
- Maximum no. of Functions per project:
- Free: 100
- Pro: 500
@@ -1,14 +1,19 @@
---
title = "Edge Function bundle size issues"
topics = [ "functions" ]
keywords = [ "bundle", "size", "limit", "dependencies", "edge function", "10MB" ]
keywords = [ "bundle", "size", "limit", "dependencies", "edge function", "5MB", "20MB" ]
database_id = "aaf9e673-64ae-460a-88e0-b83ea4963382"
[api]
cli = [ "supabase-functions-deploy" ]
---
Edge Functions have a 20MB source code limit. If your function exceeds this limit, deployment will fail.
The maximum size of a deployed Edge Function depends on how it's bundled:
- **Local bundling (Supabase CLI):** up to **20 MB**. The CLI bundles your function and its dependencies on your machine before uploading.
- **Server-side bundling (Management API or Dashboard):** up to **5 MB**. When you deploy without local bundling, bundling runs on the server, which has a lower infrastructure limit.
If your function exceeds the applicable limit, deployment fails with an error such as `Function source code exceeds the maximum deployment size`.
## Check your bundle size
@@ -48,6 +53,10 @@ Consider breaking large functions into smaller, more focused functions. Each fun
Research smaller packages that provide the same functionality. Many NPM packages designed for Node.js include unnecessary polyfills that increase bundle size.
## Deploying larger functions
If your function is under 20 MB but exceeds the 5 MB server-side limit, bundle it locally with the Supabase CLI to get the higher limit. Run `supabase functions deploy` with the `--use-docker` flag to force local bundling.
## Additional resources
- [Unable to deploy Edge Function](./unable-to-deploy-edge-function)