When calling supabase db reset I get this error: failed to send batch: ERROR: Out of memory (SQLSTATE XX000).
It breaks because of one migration where I create a db function that uses the postgres net extension.
-- Function to send Slack notification for new users
CREATE OR REPLACE FUNCTION public.send_slack_new_user_notification(new_user_record jsonb)
RETURNS void
LANGUAGE plpgsql
SECURITY DEFINER
set search_path = public
AS
$function$
DECLARE
_project_url text;
_anon_key text;
_url text;
_headers jsonb;
BEGIN
-- Get project URL and anon key dynamically
SELECT public.get_project_url() INTO _project_url;
SELECT public.get_anon_key() INTO _anon_key;
-- Construct the full function URL
_url := format('%s/functions/v1/on_new_user_slack_notify', _project_url);
-- Construct the headers with the anon key
_headers := format('{"Content-Type": "application/json", "Authorization": "Bearer %s"}', _anon_key)::jsonb;
-- Perform a web request to our Edge Function
select "net"."http_post"(
url:= _url,
body:=jsonb_build_object('record', new_user_record),
headers:= _headers
);
END;
$function$;
When I comment the lines where I make the request it works.
I tried to increase memory in db.settings (shared_buffers, work_mem, maintenance_work_mem) but it did not help.
Does anyone has an idea how to resolve this?
pg_column_size(new_user_record)isn't suspiciously large, you might want to contact community or official supabase support.body:=jsonb_build_object('record', new_user_record),is not returning what you think it is. I would make therequestdirectly, outside function and database, and see what you get.