Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add health check edge function (#26823)

Joshen Lim65eb68b0eedc
diff --git a/supabase/functions/health-check/index.ts b/supabase/functions/health-check/index.ts
new file mode 100644
index 00000000000..66b2efb4191
--- /dev/null
+++ b/supabase/functions/health-check/index.ts
@@ -0,0 +1,21 @@
+import { serve } from "https://deno.land/[email protected]/http/server.ts";
+
+serve(async (req) => {
+ const data = { healthy: true };
+ const corsHeaders = {
+ "Access-Control-Allow-Origin": "*",
+ "Access-Control-Allow-Methods": "POST",
+ "Access-Control-Allow-Headers":
+ "authorization, x-request-id, apikey, content-type, user-agent, sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform, referer, accept",
+ };
+
+ // This is needed if you're planning to invoke your function from a browser.
+ if (req.method === "OPTIONS") {
+ return new Response("ok", { headers: corsHeaders });
+ }
+
+ return new Response(JSON.stringify(data), {
+ headers: { ...corsHeaders, "Content-Type": "application/json" },
+ status: 200,
+ });
+});