Repository navigation
fix: preserve function responses - #47920
Conversation
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@7ttp is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe edge-function test proxy now preserves upstream response bodies as text, aggregates duplicate headers, embeds upstream status data in HTTP 200 responses, and surfaces documentation links for recognized error codes. ChangesEdge function response proxy
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Studio
participant TestHandler
participant EdgeFunction
participant EdgeFunctionTesterSheet
participant ErrorDocs
Studio->>TestHandler: POST edge-function test request
TestHandler->>EdgeFunction: fetch request
EdgeFunction-->>TestHandler: status, headers, text body
TestHandler-->>EdgeFunctionTesterSheet: HTTP 200 response envelope
EdgeFunctionTesterSheet->>ErrorDocs: getEdgeFunctionErrorDocs(headers)
ErrorDocs-->>EdgeFunctionTesterSheet: documentation code and href
EdgeFunctionTesterSheet-->>Studio: render response and Error docs link
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/studio/pages/api/edge-functions/test.ts (1)
80-98: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReminder: Verify if this change requires mirroring to TanStack Start routes.
Studio is mid-migration from the Next.js pages router to TanStack Start. Since you've modified logic in a
pages/api/...file (apps/studio/pages/api/edge-functions/test.ts), please ensure the corresponding mirror inapps/studio/routes/api/edge-functions/test.tsis updated as well, if it exists and duplicates rather than re-exports this logic. If the route file simply re-exports this handler, no further action is needed. As per path instructions, do not delete thepages/**file.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/pages/api/edge-functions/test.ts` around lines 80 - 98, Verify whether the TanStack Start counterpart for the edge-functions test handler duplicates the response-header and response-body logic from the pages route. If the corresponding route exists and contains duplicated logic, apply the same update there; if it re-exports the pages handler or does not exist, leave it unchanged.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/studio/pages/api/edge-functions/test.ts`:
- Around line 80-98: Verify whether the TanStack Start counterpart for the
edge-functions test handler duplicates the response-header and response-body
logic from the pages route. If the corresponding route exists and contains
duplicated logic, apply the same update there; if it re-exports the pages
handler or does not exist, leave it unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 287c0f5b-5558-4152-837a-d40bec689281
📒 Files selected for processing (3)
apps/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.types.tsapps/studio/pages/api/edge-functions/test.tsapps/studio/tests/pages/api/edge-functions/test.test.ts
|
Hey @7ttp, following the CLI changes supabase/cli#5862 In case This way, you can render a documentation link based on the error code, like EDGE_FUNCTION_ERROR 'https://supabase.com/docs/guides/functions/error-codes' +
'EDGE_FUNCTION_ERROR' => 'edgefunctionerror'
-> 'https://supabase.com/docs/guides/functions/error-codes#edgefunctionerror' |
Braintrust eval report
|
## TL;DR
standardizes JWT admission failures across legacy and next local
runtimes with
`{ code, message }` and `sb-error-code` while preserving legacy `msg`
for BC
## Ref
- Paired with supabase/supabase#47920
& supabase/supabase#48012
- Related to supabase#5861 &
supabase/supabase#47835
…fomap-entry-for-pitr-archiving-stale' into hunleyd/indata-979-studio-lintinfomap-entry-for-pitr-archiving-stale * origin/hunleyd/indata-979-studio-lintinfomap-entry-for-pitr-archiving-stale: (35 commits) chore: simplify CPU messaging for compute sizes (#48109) chore(studio): add valtio and react-hook-form ESLint ratchet rules (#48037) feat: Add ai/python federated content and data (#48043) feat: Add ai-skills federated content and data (#48045) feat: Add deployment/ci federated content and data (#48041) fix(studio): wire up siwc-enabled query param opt-in on sign-in/sign-up (#48126) fix(studio): stop stacking overlaid area series in report charts (#48034) Update Dev toolbar to support filtering feature flags (#48137) Update dev toolbar to support mocking org restrictions (#48136) feat: Add terraform federated content and data (#48010) Chore/add sessions database connections (#48094) fix(studio): guard panel collapse/resize on narrow viewports (#48098) Landing page agent focus (#47989) fix(studio): chip away explicit-tabindex ratchet debt (#48040) fix(studio): untangle nested buttons in editor tabs (#48101) fix(docs): broken link (#48117) docs: add VS Code to the AI coding agent plugin install picker (#48108) docs: add Kimi Code to MCP and AI coding agent plugin setup (#48099) fix: preserve function responses (#47920) fix(assistant): SQL approval buttons do nothing (#48102) ...

Summary by CodeRabbit
New Features
sb-error-codeheader is present.Bug Fixes
Tests