Replies: 3 comments
|
Have you turned on Database Webhooks in the integration section https://supabase.com/dashboard/project/_/integrations/webhooks/overview |
|
So You can confirm the before/after state without changing anything: select nspname from pg_namespace where nspname in ('net', 'supabase_functions');
select n.nspname, p.proname
from pg_proc p join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'supabase_functions';After enabling, the second query should return To unblock the Edge Function in the meantime, skip the wrapper and write the trigger against create or replace function public.notify_appointment_change()
returns trigger
language plpgsql
security definer
as $$
begin
perform net.http_post(
url := 'https://<project-ref>.supabase.co/functions/v1/notify-appointment-change',
headers := jsonb_build_object(
'Content-Type', 'application/json',
'Authorization', 'Bearer ' || current_setting('app.settings.service_key', true)
),
body := jsonb_build_object(
'type', TG_OP,
'table', TG_TABLE_NAME,
'schema', TG_TABLE_SCHEMA,
'record', to_jsonb(new),
'old_record', case when TG_OP = 'UPDATE' then to_jsonb(old) end
)
);
return new;
end;
$$;
create trigger appointments_webhook
after insert or update on public.appointments
for each row execute function public.notify_appointment_change();Keep the service key out of the migration — read it from Vault or a database setting rather than inlining it. Delivery is async either way, so check |
|
Tracing this through the source, What creates the schemaThe dashboard decides whether webhooks are enabled purely by whether the schema exists, in SELECT EXISTS (
SELECT 1 FROM information_schema.schemata
WHERE schema_name = 'supabase_functions'
) AS schema_exists;The enable script in the same file is what creates it, at line 125: CREATE SCHEMA supabase_functions AUTHORIZATION supabase_admin;
ALTER function "supabase_functions".http_request() OWNER TO supabase_functions_admin;So the trigger function is owned by Note the direction of the dependency: the enable script itself runs Why
|
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm trying to create a Supabase Database Webhook for an
appointmentstable, triggering on INSERT and UPDATE and calling a deployed Edge Function.When I create the webhook from the Supabase Dashboard, I get:
ERROR: 3F000: schema "supabase_functions" does not exist
The project has
pg_netenabled and thenetschema is present, but thesupabase_functionsschema is missing.What I am trying to configure
appointmentsnotify-appointment-changeThe Edge Function is already deployed and works independently.
What I checked
pg_netis enabled on the project.netschema exists.supabase_functionsschema does not exist.supabase_functionsschema or custom SECURITY DEFINER workaround.This appears to happen during the Dashboard's Database Webhook provisioning itself, before the webhook can be created.
I also found reports/issues describing the same
supabase_functionsschema error.I have opened a Supabase Support ticket for the same project as well:
SU-468550.Environment
pg_netis enabledIs there currently a known issue with Database Webhook provisioning / the
supabase_functionsschema?If so, is there an official workaround or is this something that needs to be fixed on the Supabase platform side?
Thanks!
All reactions