Supabase Edge Functions run on the Deno runtime and deploy globally close to users. They integrate tightly with the Supabase platform via database webhooks, secrets management, and the client SDK's invoke() method.
0 / 5 completed
1 / 5
What runtime do Supabase Edge Functions use?
Supabase Edge Functions run on Deno, the secure TypeScript-first runtime. Deno's permission model, built-in TypeScript support, and Web API compatibility make it a natural fit for edge functions. Functions are deployed globally close to users via Supabase's edge network.
2 / 5
How do you handle CORS in a Supabase Edge Function?
CORS in Supabase Edge Functions must be handled manually. You return the necessary headers (Access-Control-Allow-Origin, etc.) in your responses and explicitly handle the OPTIONS preflight request. Supabase provides a corsHeaders helper pattern in its documentation as a starting point.
3 / 5
What is the purpose of database webhooks combined with Edge Functions in Supabase?
Database webhooks in Supabase send an HTTP POST to a specified URL (typically an Edge Function) whenever a row changes in a configured table. This pattern enables real-time side effects such as sending emails on signup, syncing to external services, or triggering analytics without modifying application code.
4 / 5
How do you access secrets (environment variables) inside a Supabase Edge Function?
Secrets in Supabase Edge Functions are set with supabase secrets set KEY=value (CLI) and accessed at runtime with Deno.env.get('KEY'). This keeps sensitive values like API keys out of source code and allows different values per environment (local vs. production).
5 / 5
What does the invoke() method on the Supabase client do?
supabase.functions.invoke('function-name', options) is the client-side SDK method to call an Edge Function. It handles authentication headers automatically (passing the user's JWT), serialises the body, and returns the parsed response. It is the recommended way to call Edge Functions from a browser or mobile client.