Commit Graph
1 Commits
Author SHA1 Message Date
311e2c721c fix(studio): suggest cli download when function code exceeds max size limit (#53421)
<!-- claude-slack-attribution -->
_Requested by **Kalleby Santos** · [Slack
thread](https://supabase.slack.com/archives/C02KMRX22NR/p1794750855761849?thread_ts=1794750855.761849&cid=C02KMRX22NR)_

## Problem

**Before:** When an Edge Function's source is too large to load in
Studio, the function's Code tab shows "Failed to load function code"
with the same steps as any other load failure: update the CLI, then
redeploy with `supabase functions deploy` or use the Management API.
Redeploying does not help here, because the problem is the size of the
code, not a bad deployment.

**After:** When the function body request fails because the code exceeds
the maximum size (HTTP 507), the same error screen tells the reader to
update the CLI and then download the function with `supabase functions
download <function-slug>`. All other load errors keep the existing
redeploy and Management API steps.

## Solution

Adds `isFunctionBodyMaxSizeError` (true when the error code is 507) next
to the function body query, and the Code page uses it to pick which step
2 to show. Studio already preserves the HTTP status as `error.code`, so
no changes to error classification are needed.

This ports Kalleby's fork commit
[498a1b1](https://github.com/kallebysantos/supabase/commit/498a1b1b386accea4fa57a85a3a2328b79a3b34c)
onto current master. Differences from the original: it types the helper
against Studio's current error shape instead of `ResponseError`, fixes
the "Donwload" typo, and adds a small unit test for the helper.

Co-authored-by: Kalleby Santos <kalleby_santos@hotmail.com>

## Review instructions

1. Open a function's Code tab where the function body request returns
507 (for example by mocking the response) and confirm step 2 reads
"Download your function using: `supabase functions download <slug>`"
with no Management API step.
2. Trigger any other body load error and confirm the redeploy and
Management API steps are unchanged.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill (not applicable, no docs
changes)

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

---------

Co-authored-by: Kalleby Santos <kalleby_santos@hotmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-16 12:08:27 +00:00