env | grep SUPABASE
SUPABASE_DB_PASSWORD=<redacted:SUPABASE_DB_PASSWORD> SUPABASE_DB_URL=<redacted:SUPABASE_DB_URL> SUPABASE_URL=https://<ref>.supabase.co SUPABASE_SERVICE_ROLE_KEY=<redacted:SUPABASE_SERVICE_ROLE_KEY> SUPABASE_PROJECT_REF=<ref> SUPABASE_ANON_KEY=<redacted:SUPABASE_ANON_KEY>
psql $SUPABASE_DB_URL -c "SELECT * FROM pg_extension;"
oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
-------+--------------------+----------+--------------+----------------+------------+-----------+--------------
13615 | plpgsql | 10 | 11 | f | 1.0 | |
16393 | pg_stat_statements | 16388 | 16392 | t | 1.11 | |
16436 | uuid-ossp | 16388 | 16392 | t | 1.1 | |
16447 | pgcrypto | 16388 | 16392 | t | 1.3 | |
16608 | supabase_vault | 10 | 16607 | f | 0.3.1 | {16612} | {""}
(5 rows)
psql $SUPABASE_DB_URL -c "CREATE EXTENSION IF NOT EXISTS pg_net;"
CREATE EXTENSION
psql $SUPABASE_DB_URL -c "\d public.signups"
Table "public.signups"
Column | Type | Collation | Nullable | Default
------------+--------------------------+-----------+----------+----------------------------------
id | bigint | | not null | generated by default as identity
email | text | | not null |
plan | text | | not null | 'free'::text
created_at | timestamp with time zone | | not null | now()
Indexes:
"signups_pkey" PRIMARY KEY, btree (id)
psql $SUPABASE_DB_URL -c "SELECT * FROM pg_extension;"
oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition
-------+--------------------+----------+--------------+----------------+------------+-----------+--------------
13615 | plpgsql | 10 | 11 | f | 1.0 | |
16393 | pg_stat_statements | 16388 | 16392 | t | 1.11 | |
16436 | uuid-ossp | 16388 | 16392 | t | 1.1 | |
16447 | pgcrypto | 16388 | 16392 | t | 1.3 | |
16608 | supabase_vault | 10 | 16607 | f | 0.3.1 | {16612} | {""}
19437 | pg_net | 10 | 19409 | f | 0.20.4 | |
(6 rows)
curl -X POST -H "Authorization: Bearer $SUPABASE_SERVICE_ROLE_KEY" -H "Content-Type: application/json" -d '{"email":"test@example.com", "plan":"pro"}' $SUPABASE_URL/functions/v1/hook-recorder{"ok":true} % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 53 0 11 100 42 39 152 --:--:-- --:--:-- --:--:-- 192
psql $SUPABASE_DB_URL -c "SELECT * FROM public.webhook_receipts"
id | received_at | payload
----+-------------------------------+----------------------------------------------
2 | 2026-07-24 05:13:55.672479+00 | {"plan": "pro", "email": "test@example.com"}
(1 row)
cat << 'EOF' > sql_script.sql
CREATE OR REPLACE FUNCTION notify_webhook() RETURNS TRIGGER AS $$
DECLARE
url TEXT := current_setting('custom.my_supabase_url', true) || '/functions/v1/hook-recorder';
auth_header TEXT := 'Bearer ' || current_setting('custom.my_supabase_service_role_key', true);
payload JSONB;
request_id BIGINT;
BEGIN
payload := jsonb_build_object(
'email', NEW.email,
'plan', NEW.plan
);
SELECT net.http_post(
url := url,
headers := jsonb_build_object(
'Content-Type', 'application/json',
'Authorization', auth_header
),
body := payload
) INTO request_id;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
DROP TRIGGER IF EXISTS signups_webhook_trigger ON public.signups;
CREATE TRIGGER signups_webhook_trigger
AFTER INSERT ON public.signups
FOR EACH ROW
EXECUTE FUNCTION notify_webhook();
EOF
psql $SUPABASE_DB_URL -f sql_script.sqlCREATE FUNCTION DROP TRIGGER CREATE TRIGGER
psql:sql_script.sql:26: NOTICE: trigger "signups_webhook_trigger" for relation "public.signups" does not exist, skipping
psql $SUPABASE_DB_URL -c "ALTER DATABASE postgres SET custom.my_supabase_url TO '$SUPABASE_URL';"
ERROR: permission denied to set parameter "custom.my_supabase_url"
psql $SUPABASE_DB_URL -c "ALTER ROLE postgres SET custom.my_supabase_url TO '$SUPABASE_URL';"
ERROR: permission denied to set parameter "custom.my_supabase_url"
cat << 'EOF' > sql_script2.sql
CREATE OR REPLACE FUNCTION notify_webhook() RETURNS TRIGGER AS $$
DECLARE
url TEXT;
auth_header TEXT;
payload JSONB;
request_id BIGINT;
BEGIN
-- Need a better way to store these or just hardcode them in the function body.
url := 'https://<ref>.supabase.co/functions/v1/hook-recorder';
auth_header := 'Bearer <redacted:SUPABASE_SERVICE_ROLE_KEY>';
payload := jsonb_build_object(
'email', NEW.email,
'plan', NEW.plan
);
SELECT net.http_post(
url := url,
headers := jsonb_build_object(
'Content-Type', 'application/json',
'Authorization', auth_header
),
body := payload
) INTO request_id;
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
EOF
psql $SUPABASE_DB_URL -f sql_script2.sqlCREATE FUNCTION
psql $SUPABASE_DB_URL -c "INSERT INTO public.signups (email, plan) VALUES ('hello2@example.com', 'enterprise');"INSERT 0 1
sleep 5; psql $SUPABASE_DB_URL -c "SELECT * FROM public.webhook_receipts"
id | received_at | payload
----+-------------------------------+-------------------------------------------------------
2 | 2026-07-24 05:13:55.672479+00 | {"plan": "pro", "email": "test@example.com"}
3 | 2026-07-24 05:14:19.473104+00 | {"plan": "enterprise", "email": "hello2@example.com"}
(2 rows)
psql $SUPABASE_DB_URL -c "GRANT EXECUTE ON FUNCTION notify_webhook() TO PUBLIC;"
GRANT
psql $SUPABASE_DB_URL -c "\df notify_webhook"
List of functions Schema | Name | Result data type | Argument data types | Type --------+----------------+------------------+---------------------+------ public | notify_webhook | trigger | | func (1 row)
A shell script executed against the live project and asserted on the state the agent left behind. No model judged another model.
Raw transcript · Task definition and verifier · Every attempt