# Supabase Edge Function timeout: the 150s/400s wall-clock and 2s CPU limits

> Supabase Edge Functions cap wall-clock duration at 150s (Free) or 400s (paid), memory at 256MB, and actual CPU time per request at 2s. What each limit means and which one is actually failing your function.

Source: https://scribase.com/supabase-edge-function-timeout

A function that "times out" on Supabase can be hitting any of three separate, documented ceilings — wall-clock duration, CPU time, or memory — and the fix is different for each. Supabase's own limits page states all three; here is how to tell which one is actually firing.

## The three limits

_From supabase.com/docs/guides/functions/limits, checked live 2026-11-18_

| Limit | Value |
| --- | --- |
| Wall-clock duration (Free) | 150 seconds |
| Wall-clock duration (paid) | 400 seconds |
| Memory | 256 MB |
| CPU time per request | 2 seconds (actual CPU time, excluding async I/O wait) |
| Request idle timeout | 150 seconds before a 504 if no response is sent |

## Sources

- [Supabase: Edge Function limits](https://supabase.com/docs/guides/functions/limits)

## Which limit is actually firing

- A function waiting on a slow upstream API or database query is spending wall-clock time, not CPU time — the 2-second CPU limit explicitly excludes async I/O wait, so a function stuck waiting (not computing) runs into the 150s/400s wall-clock or the 150s idle timeout first, not the CPU cap.
- A function doing heavy in-process computation (parsing a large payload, running a tight loop, image or data transformation in pure JS/TS) burns CPU time directly and can hit the 2-second CPU cap long before wall-clock duration becomes the issue.
- A 504 specifically means the request idle timeout fired: no response was sent within 150 seconds, regardless of plan — this is the idle timeout, separate from the longer paid wall-clock ceiling for functions that are still actively running (streaming, background work) rather than stuck idle.
- Running out of the 256MB memory limit crashes the function outright rather than producing a timeout; the symptom there is a function error, not a slow response.

## Sources

- [Supabase: Edge Function limits](https://supabase.com/docs/guides/functions/limits)

## Same Deno runtime family on Scribase

Scribase Functions run on the same Deno runtime family as Supabase Edge Functions, so the same category of limit (wall-clock duration, CPU time, memory) applies in the same shape — splitting CPU-bound work from I/O-bound waiting is the same fix on either platform: move heavy computation out of the request path (a queue, a background job) rather than trying to out-wait a fixed ceiling.

## Sources

- [Scribase pricing](https://scribase.com/pricing)

## FAQ

**Does upgrading from Free to a paid plan fix every timeout?**

It raises the wall-clock ceiling (150s to 400s), per Supabase's own limits page, but it does not raise the 2-second CPU time limit or the 256MB memory limit — a function hitting either of those keeps hitting them on a paid plan too.

**Why does my function time out even though it finishes fast locally?**

Local runs usually skip the network latency to a managed database or an external API that production traffic hits every time; a function that is fast locally but slow in production is more likely hitting the wall-clock/idle-timeout limit from real-world I/O latency than the CPU limit.

**Does the 2-second CPU limit include time spent waiting on a database query?**

No. Supabase's limits page specifies CPU time as actual CPU time, excluding async I/O wait — a function awaiting a query is not spending CPU time while it waits.

**What gets a 504 specifically, versus some other error?**

A 504 Gateway Timeout is what Supabase's docs attach to the 150-second request idle timeout: no response sent in that window. A CPU-limit or memory-limit failure surfaces as a function execution error, not a 504.

## Related

- [Supabase Edge Function cold start](https://scribase.com/supabase-edge-function-cold-start)
- [Postgres connection limit (serverless)](https://scribase.com/postgres-connection-limit-serverless)
- [Supabase alternative](https://scribase.com/supabase-alternative)
- [Pricing](https://scribase.com/pricing)