DEV Community

Cover image for How I Fixed a Silent 500 Error in My Supabase Edge Function
Suman Gorai
Suman Gorai

Posted on

How I Fixed a Silent 500 Error in My Supabase Edge Function

How I Fixed a 500 Error That Was Silently Killing My SaaS

I launched Torziva — an AI virtual try-on
tool for fashion stores — and users were getting 500 errors on
every try-on attempt.

The weird part? Supabase logs showed nothing. Completely blank.


The Symptom

  • Browser console: Failed to load resource: 500
  • Supabase edge function logs: blank
  • fal.ai dashboard: requests weren't even arriving

Classic "where is the request dying?" mystery.


The Investigation

Step 1 — Checked Vercel env vars

My edge function was hosted on Supabase but the request
originated from Vercel. Turned out FAL_API_KEY was missing
from Supabase secrets — it was only in Vercel.

Added it to Supabase → still failing.

Step 2 — Checked the actual error

Added more granular try/catch logging and finally saw it:

Error: Processing timeout. Please try again.
Enter fullscreen mode Exit fullscreen mode

Step 3 — Found the real culprit

My polling loop was set to 60 attempts × 2000ms = 120 seconds.

Supabase edge functions have a default timeout of 60 seconds.

The function was dying before fal.ai even finished processing.


The Fix

Two changes in the edge function:

// Before
const maxAttempts = 60;
num_inference_steps: 30,

// After  
const maxAttempts = 25;  // 25 × 1500ms = ~37 seconds
num_inference_steps: 20, // faster generation
Enter fullscreen mode Exit fullscreen mode

Also changed polling interval from 2000ms to 1500ms.

Total processing time dropped from ~90s to ~35s.
Now well within Supabase's limit.


The Lesson

If your Supabase edge function logs are blank, the function
isn't crashing — it's timing out before it can log anything.

Always check:

  1. Are your secrets in Supabase, not just Vercel?
  2. Is your total execution time under 60s?
  3. Are external API calls (fal.ai, OpenAI, etc.) taking longer than expected?

Stack

  • Supabase Edge Functions (Deno)
  • fal.ai IDM-VTON for try-on generation
  • Next.js 14 + Vercel frontend

If you're building anything with fal.ai or Supabase edge
functions, happy to answer questions in the comments.

And if you run a fashion store — this is what powers
torziva.site 👕

Top comments (0)