https://supabase.com/ logo
#help
Title
# help
d

dipesh

05/21/2022, 10:35 AM
Hi guys, I was trying to do http post request in postgres function. But I get the following error. Please provide your expertise 🙏
function http_post(unknown, unknown, unknown) does not exist
What I did? - Turn on HTTP extension - Sample Function
Copy code
create or replace function public.handle_new_user() 
returns trigger 
language plpgsql 
security definer 
as $$
begin
  select 
   "status", "content"::jsonb
     from  http_post(
    'https://app.doneo.io:5000/notification',
    '{"user": new.email,"provider":new.provider}',
    'application/json'
  );
  return new;
end;
$$;
n

Needle

05/21/2022, 10:35 AM
Hello @dipesh! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g

garyaustin

05/21/2022, 2:31 PM
try adding
Copy code
SET search_path = extensions, public, pg_temp;
n

Needle

05/21/2022, 2:31 PM
dipesh (2022-05-21)
g

garyaustin

05/21/2022, 2:31 PM
after security definer
d

dipesh

05/21/2022, 3:37 PM
Thanks it works.
n

Needle

05/21/2022, 3:47 PM
Thread was archived by @dipesh. Anyone can send a message to unarchive it.