How to access secrets inside triggers in local Docker
I have a simple trigger (with security definer) which calls a function (with security definer) which then uses the recommended way to get a decrypted secret from the vault.
This works in my client DBeaver when connected as
postgres but when I try via my React app (which has role authenticated ) it gives a decryption error:
my function:
When I INSERT from my DB client I can see the trigger logging:
But from postgrest I can see the role is different:
I'm using the basic docker/compose setup with latest image and SDK
It doesnt seem to be an issue in my production/cloud/supabase version of my project3 Replies
Could i ask what you mean when you say your trigger has security definer? I couldn't find anything related to setting such privileges for triggers?
Sorry I mean the func the trigger calls
How have you set up the vault secrets, was it via the UI? Is there any chance you have done any schema dump recently from remote?