Database trigger
I created a database trigger that triggers my edge function whenever there is a change in the table to send the email notification to my client when their task is completed
I tested my edge function and everything is working great there but there is something wrong with the database trigger
While brainstorming with Claude, we experienced some issue with service role key being false when running a value details check SQL
Is there any new Supabase service role key that I should be using? Not anon of course

4 Replies
You can use
raise log 'var = %',var;
in your trigger function and check Postgres logs for debugging help.
I assume you meant database trigger function as a trigger can't call pg_net or http extension on its own.
Do the Edge function logs show anything?
If you are using the new API keys then you need turn off JWT checking in the function. Above you show the older key and that should work either way.Thank you Gary! Yes, I meant database trigger function. I couldn’t find any logs
So I abandoned the pg_net and database trigger function and just implemented the email notification sending logic with my existing edge function that is handling my scheduled tasks logic. So, now it works perfectly and it’s much better solution
By the way, do you recommend using the new API keys?
I've checked them out on a test instance and can switch back and forth with no issue. If you are using a bunch of edge functions I would make sure you check everything out as those seems to have the biggest impact from the new keys.
Great! Thank you!