You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{corsHeaders}from'../_shared/cors.ts'Deno.serve(async(req)=>{// Handle CORS preflight requestsif(req.method==='OPTIONS'){returnnewResponse('ok',{headers: corsHeaders})}// Your function logic herereturnnewResponse(JSON.stringify({status: 'Success'}),{headers: { ...corsHeaders,'Content-Type': 'application/json'},})})
Debugging tools
Supabase provides two debugging tools for Edge Functions:
Invocations: Shows the Request and Response for each execution
Logs: Shows platform events, including deployments and errors
Access these tools by navigating to Functions > [Your Function] in the dashboard.
Common issues
CORS errors
Missing Access-Control-Allow-Origin header in response
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the original article.
If you're having trouble invoking an Edge Function or experiencing CORS issues, follow these steps to diagnose and resolve the problem.
Diagnose the issue
Proper CORS handling
Make sure your function handles OPTIONS preflight requests.
Recommended (v2.95.0+)
For versions before 2.95.0
If you're using
@supabase/supabase-jsbefore v2.95.0, you'll need to hardcode the CORS headers. Add acors.tsfile within a_sharedfolder:Then import it in your function:
Debugging tools
Supabase provides two debugging tools for Edge Functions:
Access these tools by navigating to Functions > [Your Function] in the dashboard.
Common issues
CORS errors
Access-Control-Allow-Originheader in responseAuthentication errors
Network errors
Additional resources
All reactions