Closed Oksitaine closed 5 months ago
I correct the bug, i'm stupid x)
If someone have the same error, i made this change to the code bellow :
create or replace function launch_generation()
returns trigger
as $$
declare
json_post jsonb;
json_header jsonb;
request_id bigint;
begin
if new.step_tunnel = 'Need_wait_prediction' then
json_post := jsonb_build_object('version', '5fefgd3R***')
|| jsonb_build_object('input', jsonb_build_object('urls', new.picture_zip_link));
json_header := jsonb_build_object('Authorization','Token r8_***');
select *
into json_post
net.http_post(
url := 'https://api.replicate.com/v1/predictions',
body := json_post,
headers := json_header
) as request_id;
end if;
return new;
end;
$$ language plpgsql;
create trigger trigger_launch_generation
after update on public.customer_purchase
for each row
execute procedure launch_generation();
Bug report
Describe the bug
I want to make a HTTP POST request with supabase and for that i use a trigger in my table. This post request need to have a headers for a token so i use pg_net for that. I install the pg_net extensions with the supabase dashboard. I write the following code :
But when i make the change in my public.customer_purchase and this function is launch, i got always the same error in supabase :
I try to solve this, i read the pg_net documentation but that don't change...
Expected behavior
I just want the http post request succes.
Screenshots
This is the toast message i got went i change the value in my table for launch the trigger
trigger_launch_generation
:Additional context
Thanks for all people by advance he will help me with this bug ! ;)