© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•14mo ago•
2 replies
datarecall

Proper Way To Call Edge From Trigger

What is the proper way to call an edge point from a trigger, basically what I am trying to do is do an api request to a 3rd party when a token is created, I am currently locally hosting for dev.

CREATE OR REPLACE FUNCTION trigger_update_token_metadata()
RETURNS TRIGGER AS $$
BEGIN
  PERFORM net.http_post(
    url := 'http://api:8000/functions/v1/update-token-metadata',
    body := jsonb_build_object('record', to_jsonb(NEW)),
    headers := '{"Content-Type": "application/json"}'::jsonb
  );
  RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

CREATE TRIGGER update_token_metadata_trigger
AFTER INSERT ON tokens
FOR EACH ROW
EXECUTE FUNCTION trigger_update_token_metadata();
CREATE OR REPLACE FUNCTION trigger_update_token_metadata()
RETURNS TRIGGER AS $$
BEGIN
  PERFORM net.http_post(
    url := 'http://api:8000/functions/v1/update-token-metadata',
    body := jsonb_build_object('record', to_jsonb(NEW)),
    headers := '{"Content-Type": "application/json"}'::jsonb
  );
  RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

CREATE TRIGGER update_token_metadata_trigger
AFTER INSERT ON tokens
FOR EACH ROW
EXECUTE FUNCTION trigger_update_token_metadata();
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Calling edge function from database trigger
SupabaseSSupabase / help-and-questions
13mo ago
Edge function <> Trigger
SupabaseSSupabase / help-and-questions
13mo ago
Proper way to createUrls from multiple rows
SupabaseSSupabase / help-and-questions
3y ago
Call Edge Functions from Database Functions
SupabaseSSupabase / help-and-questions
7mo ago