Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/supabase-webhooks-events

@0d57af8
Run it yourself

Implement Supabase database webhooks, pg_net async HTTP, LISTEN/NOTIFY, and Edge Function event handlers with signature verification. Use when setting up database webhooks for INSERT/UPDATE/DELETE events, sending HTTP requests from PostgreSQL triggers, handling Realtime postgres_changes as an event source, or building event-driven architectures. Trigger with phrases like "supabase webhook", "database events", "pg_net trigger", "supabase LISTEN NOTIFY", "webhook signature verify", "supabase event-driven", "supabase_functions.http_request".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/supabase-webhooks-events

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referenceserrors.md

≈767 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Error Handling Reference

Database Trigger Errors

Issue Cause Solution
Trigger not firing Trigger disabled or not attached ALTER TABLE orders ENABLE TRIGGER on_order_created; and verify with SELECT tgname, tgenabled FROM pg_trigger WHERE tgrelid = 'orders'::regclass;
pg_net 404 response Edge Function URL wrong or not deployed Run supabase functions deploy <name>, check URL matches project ref
pg_net 401 response Missing or invalid Authorization header Set service role key via ALTER DATABASE postgres SET app.settings.service_role_key = 'your-key';
Trigger silently fails SECURITY DEFINER without explicit search_path Add SET search_path = public, extensions; to the function definition
net._http_response empty Extension not enabled or wrong schema CREATE EXTENSION IF NOT EXISTS pg_net WITH SCHEMA extensions;
Payload too large for NOTIFY NOTIFY payload exceeds 8000 bytes Send only record IDs, fetch full data in the listener
Duplicate trigger execution Multiple triggers on same event Review with SELECT * FROM pg_trigger WHERE tgrelid = 'orders'::regclass;

Edge Function Errors

Issue Cause Solution
Invalid signature (401) Webhook secret mismatch or encoding issue Verify both sides use the same secret and UTF-8 encoding
Function timeout Processing takes too long (default 60s) Offload heavy work to a queue; return 200 immediately
Duplicate processing No idempotency check Add processed_events table with unique event_id constraint
JSON parse error Malformed payload from trigger Wrap JSON.parse() in try/catch, return 400 with details
CORS errors on Realtime Browser blocks WebSocket Ensure Supabase URL is correct; Realtime uses WSS, not HTTP

Realtime Subscription Errors

Issue Cause Solution
No events received Table not in Realtime publication Dashboard > Database > Replication > toggle table on
Subscription status CHANNEL_ERROR RLS policy blocks the subscription Ensure anon/authenticated role has SELECT on the table
Stale data after reconnect Client missed events during disconnect Re-fetch data on SUBSCRIBED status callback
Too many channels Client opening channels without cleanup Call supabase.removeChannel(channel) when unmounting

Debugging Commands

-- List all triggers on a table
SELECT tgname, tgenabled, tgtype, pg_get_triggerdef(oid)
FROM pg_trigger
WHERE tgrelid = 'public.orders'::regclass
AND NOT tgisinternal;

-- Check pg_net response log
SELECT id, status_code, content, created
FROM net._http_response
WHERE status_code >= 400
ORDER BY created DESC
LIMIT 20;

-- Verify pg_net extension is active
SELECT extname, extversion FROM pg_extension WHERE extname = 'pg_net';

Tons of Skills by Intent Solutions | jeremylongshore.com

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides production-ready templates for Supabase event-driven architectures, including webhooks, Realtime subscriptions, and Postgres LISTEN/NOTIFY. It correctly emphasizes security best practices such as HMAC signature verification and the use of secrets management for sensitive keys. A minor risk is noted regarding the inherent attack surface for indirect prompt injection via external event data.

  • Socket2mo

    2 alerts: gptAnomaly

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
What it can do
Edits files Runs commands
version
1.55.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
compatibility
Designed for Claude Code
All 4 allowed tools
WriteBash(supabase:*)Bash(curl:*)Bash(psql:*)
Other metadata
tags
[
  "saas",
  "supabase",
  "webhooks",
  "events",
  "triggers",
  "pg_net",
  "realtime"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/supabase-webhooks-events