Closed maxmckenzie closed 5 months ago
The key_id returned by this query:
insert into vault.secrets (name, secret)
values (
'stripe',
'sk_test_1234' -- replace with your sk test key this is just an example
)
returning key_id;
Should be used in place of <key_id>
in the following code:
create server stripe_server
foreign data wrapper stripe_wrapper
options (
api_key_id '<key_id>'
);
So that the actual query looks something like:
create server stripe_server
foreign data wrapper stripe_wrapper
options (
api_key_id '34661cd0-6e94-490a-8269-e3475446a9b5'
);
Assuming the insert into vault.secrets...
query returned 34661cd0-6e94-490a-8269-e3475446a9b5
key_id.
The key_id returned by this query:
insert into vault.secrets (name, secret) values ( 'stripe', 'sk_test_1234' -- replace with your sk test key this is just an example ) returning key_id;
Should be used in place of
<key_id>
in the following code:create server stripe_server foreign data wrapper stripe_wrapper options ( api_key_id '<key_id>' );
So that the actual query looks something like:
create server stripe_server foreign data wrapper stripe_wrapper options ( api_key_id '34661cd0-6e94-490a-8269-e3475446a9b5' );
Assuming the
insert into vault.secrets...
query returned34661cd0-6e94-490a-8269-e3475446a9b5
key_id.
Thanks for the reply.
It's worth noting i'm running this as a migration that runs on supabase start
, So i'm trying to retrieve the key_id and then have it passed to the create server command from just an SQL statement without me being involved (I'm not running any sql statements via the supabase dashboard).
I think i need to store the key_id as a variable in my SQL statement with DECLARE? This is what i thought was happening in the docs, but i misunderstood.
Yeah, you'll need to store it in a variable and use that.
Bug report
Describe the bug
When trying to set up the stripe fdw with the api key in the vault schema (only tested locally) The stripe fdw does not show any data and returns
invalid secret id <key_ID>: failed to parse a UUID
I've followed the docs to set up the stripe FDW locally, I've created a migration with the cli
supabase migration new stripe-fdw
Then written a basic migration
Example
However i get this error everytime i try to view the data in the stripe schema. the key is indeed present in the vault table.
However if you hard code the key like below it works.
Attempted to fix in the following ways
api_key_id '<key_ID>'
orapi_key_id '<key_id>'
or thisapi_key_id <key_id>
or thisapi_key_id key_id
orapi_key_id 'key_id'
orapi_key_id <key_ID>
api_key_id 'key_ID'
nope (didnt work)returning key_id as key_id
(didnt work)To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
mkdir test && cd test && supabase init
supabase start
supabase migration new stripe-fdw
supabase db reset
Expected behavior
I expect the stripe data to be there and for it to correctly retireve the api key form the vault
System information