--- id: 'functions-limits' title: 'Edge Functions limits' description: 'Look up the limits on Supabase Edge Functions, including memory, wall clock duration, CPU time, function size, functions per project, logs, and secrets.' --- Look up the limits and restrictions that apply to Edge Functions on Supabase's hosted platform. Check this page when any of the following happens: - A function returns `546` because it exceeded a resource limit (`WORKER_RESOURCE_LIMIT`) - A function returns `504 Gateway Timeout` because it didn't respond within the request idle timeout - A function or its [background task](/docs/guides/functions/background-tasks) shuts down when it reaches the wall clock, CPU, or memory limit ## Runtime limits The following table lists the limits on each Edge Function worker and request. | Limit | Value | Details | | ------------------------------------------------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Maximum memory | 256MB | | | [Maximum duration (wall clock limit)](/kb/troubleshooting/edge-function-limits) | Free Plan: 150s, Pro Plan and above: 400s | The duration an Edge Function worker stays active. During this period, a worker can serve multiple requests or process [background tasks](/docs/guides/functions/background-tasks). | | [Maximum CPU time](/kb/troubleshooting/edge-function-limits) | 2s | The amount of actual time spent on the CPU per worker. Doesn't include async I/O. | | Request idle timeout | 150s | If an Edge Function doesn't send a response before the timeout, it returns 504 Gateway Timeout. | ## Platform limits The following table lists the limits on functions and logs in each project. | Limit | Value | | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | | [Maximum function size](/kb/troubleshooting/edge-function-bundle-size-issues) | 20MB bundled locally with the CLI, or 5MB bundled server-side, such as with the Management API or Dashboard | | Maximum number of functions per project | Free: 100, Pro: 1000, Team: 2000, Enterprise: Unlimited | | Maximum log message length | 10,000 characters | | Log event threshold | 100 events per 10 seconds | | [Recursive or nested function calls](/docs/guides/functions/recursive-functions) | 30 requests per trace, within a 60-second window | ### Secrets The following table lists the limits on secrets in each project. | Limit | Value | | ------------------------------------- | --------------------------------------------------- | | Maximum number of secrets per project | **100** | | Secret name length | Up to **256** characters | | Maximum secret size | **48 KiB** (**24,576** characters) | | Reserved name prefix | `SUPABASE_`. Names must not start with this prefix. | ## Other limits & restrictions The following restrictions apply to all Edge Functions: - Outgoing connections to ports `25` and `587` are not allowed. - Serving of HTML content is only supported with [custom domains](/docs/reference/cli/supabase-domains) (Otherwise `GET` requests that return `text/html` will be rewritten to `text/plain`). - Web Worker API (or Node `vm` API) are not available. - Static files cannot be deployed using the API flag. You need to build them with [Docker on the CLI](/docs/guides/functions/quickstart#step-6-deploy-to-production). - Node Libraries that require multithreading are not supported. Examples: [`libvips`](https://github.com/libvips/libvips), [sharp](https://github.com/lovell/sharp). ## Related resources To work within these limits, see the following pages: - [Edge Functions status codes](/docs/guides/functions/status-codes): what a `504` or `546` response means, and how to fix it. - [Background tasks](/docs/guides/functions/background-tasks): mark background tasks, and how the wall clock, CPU, and memory limits cap them. - [Working around the secrets limit](/kb/troubleshooting/working-around-the-edge-function-secrets-limit): bundle secrets into a JSON value when you need more than 100.