> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squasher.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Supabase

> Receive errors from Supabase Edge Functions and database logs.

## Edge Functions via OpenTelemetry

Supabase Edge Functions support Deno and run on the edge. Use the HTTP API to report errors:

```typescript theme={null}
// supabase/functions/my-function/index.ts
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";

const SQUASHER_URL = `https://ingest.squasher.ai/v1/ingest/${Deno.env.get("SQUASHER_PROJECT_ID")}`;
const SQUASHER_KEY = Deno.env.get("SQUASHER_API_KEY")!;

serve(async (req) => {
  try {
    const result = await handleRequest(req);
    return new Response(JSON.stringify(result), { status: 200 });
  } catch (error) {
    // Report to Squasher
    await fetch(SQUASHER_URL, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "x-squasher-key": SQUASHER_KEY,
      },
      body: JSON.stringify({
        message: error instanceof Error ? error.message : String(error),
        type: error instanceof Error ? error.constructor.name : "Error",
        level: "error",
        stack: error instanceof Error ? error.stack : undefined,
        tags: { function: "my-function", url: req.url },
      }),
    });

    return new Response("Internal Server Error", { status: 500 });
  }
});
```

## Supabase Webhooks

Forward database webhook events (triggers, realtime errors) to Squasher:

1. Create a Database Webhook in the Supabase dashboard
2. Set the endpoint to: `https://ingest.squasher.ai/v1/drain/supabase/YOUR_PROJECT_ID`
3. Add the header: `x-squasher-key: sq_pk_your_api_key`

## Database Logs via OTel Collector

For PostgreSQL query errors from your Supabase database, see the [Docker integration](/integrations/docker) guide to set up an OTel Collector that reads database logs.

## Agent handoff

```text theme={null}
Set up Supabase telemetry for Squasher project <project_id>. Use direct HTTP for Edge Functions, a managed drain for webhook-style events, or an OTel Collector for database logs. Keep keys in Supabase secrets and verify with one function error or webhook event.
```
