cli icon indicating copy to clipboard operation
cli copied to clipboard

supabase functions deploy reuses stale function code even after deletion and redeployment

Open SteffanLynch opened this issue 7 months ago • 2 comments

Bug Description

I'm trying to deploy a Supabase Edge Function (syncStripePlan) using the CLI. The deployment appears successful (supabase functions deploy syncStripePlan), but the function URL continues returning 401 responses from logic that no longer exists in my codebase.

I have:

  • Deleted the entire supabase/functions/syncStripePlan directory and recreated it
  • Confirmed the correct code is in index.ts (no Authorization or 401 logic anywhere)
  • Deployed using supabase functions deploy — CLI says success
  • Confirmed the function is active and updated in supabase functions list
  • Called the function directly using curl — still returns:
    {"code":401,"message":"Missing authorization header"}
    

Verified this error string does NOT exist anywhere in my code Cleared and recreated index.ts multiple times Called with correct input: curl -X POST 'https://qdttopbkltomwomwpkea.functions.supabase.co/syncStripePlan'
-H "Content-Type: application/json"
-d '{"record":{"userid":"123","plan":"a"},"old_record":{"userid":"123","plan":"b"}}' Expected Behavior I expect the deployed function to reflect the latest code in index.ts, especially after a full folder deletion and recreation.

Actual Behavior Despite multiple successful supabase functions deploy operations, the function continues returning old logic with a 401 response and "Missing authorization header" message that is not present in my source code.

Supabase Project Ref qdttopbkltomwomwpkea

System Info Supabase CLI version: supabase v1.170.4 macOS 15 No Docker running Function deployed via CLI Steps to Reproduce Create an Edge Function called syncStripePlan Add console.log("DEPLOY VERSION") and deploy with CLI Delete the folder Recreate with no logic that returns 401 Redeploy Call it directly — still returns the same 401 Screenshots & Logs Function log always returns:

{ "code": 401, "message": "Missing authorization header" } Even though that logic is gone from index.ts.

Urgency High — this is blocking a production sync pipeline, and the platform appears to be caching or ignoring all new function versions.

Please advise or confirm how to fully flush/reset a deployed function.

SteffanLynch avatar Jul 09 '25 17:07 SteffanLynch

facing similar issue. updated edge functions via browser, and it keeps rolling back to the old code.

yipcma avatar Jul 20 '25 12:07 yipcma

I have the same issue here! It always roles back the"Verify JWT with legacy secret" toggle to "enabled" state

edobln avatar Nov 26 '25 15:11 edobln