You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to Set Up Vault extension on normal Postgres 15 but works fine on Supabase/Postgres 15.1.0.103 (Unmodified Postgres with some useful plugins)
#28
Open
chikkujimmy opened this issue
Aug 23, 2023
· 1 comment
Tried to build and run the Dockerfile from this repository which uses postgres:15 image, even though the docker file builds and deploys successfully with the extensions pgsoduim and supabase_vault, but when we try to insert into vault.secrets it gives the below error.
As per the above error we tried to set up pgsodium referring to its GitHub instructions by using the get key urandom script but did not help in resolving this error. After going through the documentation for vault we noticed that here it's using supabase/postgres and we modified the Dockerfile to use the supabase/postgres:15.1.0.103 docker image which comes with both vault and pgsodium installed and is working fine here. We assume some more dependencies needs to be installed while setting up on normal postgres to make it equivalent to supabase/postgres.
I just spent two days working on this issue, but I've figured it out. Starting from version 0.3.0, Supabase has removed the pgsodium dependency, as noted in this PR. Here’s what you need to do:
Drop the pgsodium extension if you’re not using it directly.
You can completely remove it by running the command: rm /usr/share/postgresql/17/extension/pgsodium*.
#!/bin/bash
KEY_FILE=/var/lib/postgresql/17/main/pgsodium_root.key
if [ ! -f "$KEY_FILE" ]; then
head -c 32 /dev/urandom | od -A n -t x1 | tr -d ' \n' > $KEY_FILE
fi
cat $KEY_FILE
restart postgres:
systemctl restart postgresql
Recreate supabase_vault extension:
DROP EXTENSION supabase_vault CASCADE;
CREATE EXTENSION supabase_vault CASCADE;
Make sure that you have supabase_vault version >0.3.0:
SELECT extversion FROM pg_extension WHERE extname = 'supabase_vault';
extversion
------------
0.3.1
Bug
Tried to build and run the Dockerfile from this repository which uses postgres:15 image, even though the docker file builds and deploys successfully with the extensions pgsoduim and supabase_vault, but when we try to insert into vault.secrets it gives the below error.
As per the above error we tried to set up pgsodium referring to its GitHub instructions by using the get key urandom script but did not help in resolving this error. After going through the documentation for vault we noticed that here it's using supabase/postgres and we modified the Dockerfile to use the supabase/postgres:15.1.0.103 docker image which comes with both vault and pgsodium installed and is working fine here. We assume some more dependencies needs to be installed while setting up on normal postgres to make it equivalent to supabase/postgres.
To Reproduce
Using Docker
Using local deployment
The text was updated successfully, but these errors were encountered: