Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding vault extension with local Supabase development #2

Open
drewbietron opened this issue Oct 24, 2022 · 7 comments
Open

Adding vault extension with local Supabase development #2

drewbietron opened this issue Oct 24, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@drewbietron
Copy link

drewbietron commented Oct 24, 2022

Bug report

Describe the bug

While adding the vault extension to a local Supabase development environment, the extension cannot be found and/or installed.

To Reproduce

Add migration file and then run migration in local Supabase database.

CREATE SCHEMA vault;
CREATE EXTENSION supabase_vault WITH SCHEMA vault;
ERROR: could not open extension control file "/usr/share/postgresql/14/extension/supabase_vault.control": No such file or directory (SQLSTATE 58P01)

Expected behavior

Am able to add the extension locally so that Supabase vault secrets that are depended on in other migration or database logic are available.

Additional context

The extension is also not available in the local Supabase Studio Extension UI. This is running the Supabase CLI v1.4.9. Have also upgraded the CLI to v1.11.2 and the problem still exists.

Have also tried running this per this blog post (which has a different extension name than this repo), but with no luck.

create extension vault with schema vault;
@drewbietron drewbietron added the bug Something isn't working label Oct 24, 2022
@michelp
Copy link
Contributor

michelp commented Dec 5, 2022

Vault is not generally released yet on production but stay tuned! We're in the final stages of testing it as well as the new UI.

@drewbietron
Copy link
Author

Saw that the docs were updated since this was announced recently. However I am still not able to install this extension locally.

CREATE EXTENSION supabase_vault CASCADE;
ERROR: could not open extension control file "/usr/share/postgresql/14/extension/supabase_vault.control": No such file or directory (SQLSTATE 58P01)

@selbyk
Copy link

selbyk commented Feb 8, 2023

I just updated all my supabase and docker images, and I also cannot install vault locally.

Migration

CREATE EXTENSION supabase_vault CASCADE;

Result

Error: ERROR: extension "supabase_vault" is not available (SQLSTATE 0A000)

@simbas
Copy link

simbas commented Feb 27, 2023

@drewbietron, @selbyk; I just try it locally today, after upgrading supabase (brew upgrade supabase) and restarting supabase services (supabase stop && supabase start), it seems available now.

supabase --version
1.38.7

here is my migration file:

CREATE EXTENSION supabase_vault CASCADE;

insert into vault.secrets
(secret, name, description)
values
  ('s3kr3t_k3y', 'secret_name', 'secret description.');

Running the following query select decrypted_secret from vault.decrypted_secrets from the SQL Editor dashboard result in:

decrypted_secret
s3kr3t_k3y

@Marviel
Copy link

Marviel commented Mar 14, 2023

AFAICT -- vault is not currently available in the CLI (Supabase CLI v1.42.5) based on this reversion: supabase/postgres@10ab188

@nlarusstone
Copy link

Note that it is enabled again supabase/postgres#598 (worked for me under CLI version 1.50.4)

@TimeTerminal
Copy link

To anyone else arriving here from Google, @simbas's solution worked for me. This should honestly be in their official docs instead of their blog.

To insert:

CREATE EXTENSION if NOT EXISTS supabase_vault;

INSERT INTO vault.secrets
(name, secret)
VALUES ('secret_name', 'secret value');

To select:

CREATE EXTENSION if NOT EXISTS supabase_vault;
SELECT * FROM vault.decrypted_secrets;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants