© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago•
14 replies
vspuzzler

Add email to resend audience using database function

Hello, I am trying to basically add an email address to my resend audience every single time after a user creates an account.

The way I am trying to make this work is with my handle_new_user function by adding something that would call my supabase edge functionthat would add the email.

Here is the code I am using for that

begin
  -- Insert into profiles table
  insert into public.profiles (id, email, full_name)
  values (
    new.id,
    new.email,
    new.raw_user_meta_data->>'full_name'
  );

  -- Asynchronous HTTP POST using pg_net to notify Edge Function
  begin
    perform net.http_post(
      url := 'https://-----.supabase.co/functions/v1/add-to-resend',
      headers := jsonb_build_object(
        'Content-Type', 'application/json'
      ),
      body := jsonb_build_object(
        'email', new.email
      )
    );
  exception when others then
    -- Silently ignore any HTTP errors
    null;
  end;

  return new;
end;
begin
  -- Insert into profiles table
  insert into public.profiles (id, email, full_name)
  values (
    new.id,
    new.email,
    new.raw_user_meta_data->>'full_name'
  );

  -- Asynchronous HTTP POST using pg_net to notify Edge Function
  begin
    perform net.http_post(
      url := 'https://-----.supabase.co/functions/v1/add-to-resend',
      headers := jsonb_build_object(
        'Content-Type', 'application/json'
      ),
      body := jsonb_build_object(
        'email', new.email
      )
    );
  exception when others then
    -- Silently ignore any HTTP errors
    null;
  end;

  return new;
end;

I enabled pg_net in the extensions tab (see image)

Basically the user is getting added to the auth fine, but the supabase edge function is not getting called which is making me think there is an issue without how I am using the function and using pg_net/calling the edge function.
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

Add email address to resend audience after account creation
SupabaseSSupabase / help-and-questions
7mo ago
Resend Invitation Email
SupabaseSSupabase / help-and-questions
6mo ago
Resend Supabase Registration Email
SupabaseSSupabase / help-and-questions
4mo ago
Resend email change email doesn't seem to work
SupabaseSSupabase / help-and-questions
3y ago