How to keep edge function not publicly accessible ?
I’m setting up an edge function that runs every 8 hours to check my users table and send emails based on a condition. Since the function handles sensitive data, I don’t want anyone to trigger it.
My plan is to generate a SHA256 key, save it in the edge function secrets, and then have the pg_cron job include the SHA256 key and auth anon key in the headers. Then check if the key == one in secrets before running the fucntion
Is this secure, or is there a better way to ensure the function is only triggered by the pg_cron job (aka supabase) every 8 hours?
Thank you
My plan is to generate a SHA256 key, save it in the edge function secrets, and then have the pg_cron job include the SHA256 key and auth anon key in the headers. Then check if the key == one in secrets before running the fucntion
Is this secure, or is there a better way to ensure the function is only triggered by the pg_cron job (aka supabase) every 8 hours?
Thank you