vault icon indicating copy to clipboard operation
vault copied to clipboard

Adding vault extension with local Supabase development

Open drewbietron opened this issue 3 years ago • 7 comments

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 avatar Oct 24 '22 16:10 drewbietron

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.

michelp avatar Dec 05 '22 17:12 michelp

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)

drewbietron avatar Jan 13 '23 22:01 drewbietron

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)

selbyk avatar Feb 08 '23 19:02 selbyk

@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

simbas avatar Feb 27 '23 16:02 simbas

AFAICT -- vault is not currently available in the CLI (Supabase CLI v1.42.5) based on this reversion: https://github.com/supabase/postgres/commit/10ab1889b9434adabad25f6b8bdb9eb39eca110a

Marviel avatar Mar 14 '23 16:03 Marviel

Note that it is enabled again https://github.com/supabase/postgres/pull/598 (worked for me under CLI version 1.50.4)

nlarusstone avatar Apr 15 '23 17:04 nlarusstone