Hey folks, I created a new trigger following almos...
# help
n
Hey folks, I created a new trigger following almost verbatim this guide: https://supabase.com/docs/guides/auth/managing-user-data#using-triggers, and now my user creation step fails. How can I dig into what's going wrong? I don't see any issues highlighted in the logs or anything
Ah ok, I found the error way back in the database logs. I'm using pgcrypto's
gen_random_bytes
inside the body of my function, and when my function executes,
gen_random_bytes
is not found
I have the line
security definer set search_path = public
in my function as in the guide, does that obscure the lookup for
gen_random_bytes
?
is there an explicit pgcrypto namespace I can use to refer to
gen_random_bytes
correctly?
Tried explicitly namespacing it to
public
, no dice:
function public.gen_random_bytes(integer) does not exist
s
Extensions are usually installed in the
extensions
schema, rather than
public
or
auth
You can always use a tool like pgAdmin to view the extensions schema and see what functions are available to be sure that's where it's installed
n
Thanks @User
if that's the case, how would I reference gen_random_bytes though?
ohhh I see, reference it via
extensions.gen_random_bytes
or set the search_path in security definer to include extensions
got it! Thank you 👍