Edge Functions
Deno functions: writing, deploying, secrets, auth, logs and limits.
15 pages · start with Edge Functions on SupaHost
- 01Edge Functions on SupaHostHow Supabase Edge Functions run on SupaHost, what's the same as Supabase Cloud, what differs (deploys, env vars, logs) and where to start.
- 02Your first Edge FunctionCreate, deploy, test and call an Edge Function on SupaHost from the dashboard in a few minutes, then update it with a new version.
- 03Writing functions: Deno, imports and structureHow to structure an Edge Function on SupaHost: the index.ts entry file, Deno.serve, npm/jsr/https imports, extra files, routing and error handling.
- 04Deploying functionsDeploy Edge Functions on SupaHost from the dashboard Functions tab or with the MCP deploy_edge_function tool, and how versions, build errors and deletes work.
- 05Environment variables and secretsThe environment variables SupaHost gives every Edge Function, how to add your own secrets in the Functions tab, naming rules and limits, and how to read them in code.
- 06Authentication and JWT verificationWhat the Require a JWT setting checks on SupaHost, why the anon key passes it, how to identify the signed-in user, restrict a function to service_role, and handle public webhooks.
- 07CORS for browser callsWhy browser calls to Edge Functions need CORS headers, how preflight requests work on SupaHost, and a reusable cors.ts helper with an origin allowlist.
- 08Calling functions from your appCall SupaHost Edge Functions with supabase-js functions.invoke, fetch, curl and other clients, pass bodies and headers, call sub-paths and handle errors.
- 09Using the database from a functionRead and write your SupaHost project's Postgres from an Edge Function with supabase-js, as the signed-in user (RLS applies) or as service_role, plus transactions via RPC.
- 10Running functions on a scheduleCall a SupaHost Edge Function every few minutes or every night with pg_cron and pg_net, keep the key in Vault, lock the function to service_role and check results.
- 11Logs and debuggingRead Edge Function logs on SupaHost in the Functions tab, over MCP or SSH, understand router error codes like BOOT_ERROR and IDLE_TIMEOUT, and debug failing functions.
- 12Edge Function limitsMemory, response time, size and count limits for Edge Functions on SupaHost, the container memory per plan, and how to work within them.
- 13Example: Stripe webhooksA complete Stripe webhook handler as a SupaHost Edge Function, with signature verification via constructEventAsync, idempotent processing and database updates.
- 14Example: sending emailSend transactional email from a SupaHost Edge Function with an email API such as Resend, safely tied to the signed-in user, and trigger it from your app or the database.
- 15Example: calling an AI modelCall OpenAI or Anthropic's Claude from a SupaHost Edge Function, keep the API key server-side, require a signed-in user and stream the answer to the browser.