vault icon indicating copy to clipboard operation
vault copied to clipboard

pgsodium_crypto_aead_det_decrypt_by_id: invalid ciphertext after compose down & up

Open epenabella opened this issue 2 years ago • 3 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Have a setup with Stripe Wrapper and server
  2. Add Vault Key for server
  3. Compose Down docker
  4. Compose Up
  5. Any queries against the Foreign Data Tables have the error pgsodium_crypto_aead_det_decrypt_by_id: invalid ciphertext (it will also have an error on supabase studio and in postgres directly running any queries connected to the foreign data tables)

Expected behavior

image

Screenshots

image

System information

  • OS: macOS development against Ubuntu VPS
  • using Brave & Firefox
  • supabase/postgres:15.1.0.103 & wrappers extension

Additional context

re-adding the secret and changing the server apikey option fixes it, but it's a hassle

epenabella avatar Sep 08 '23 13:09 epenabella

Take a look at #27

bartoszpijet avatar Nov 10 '23 15:11 bartoszpijet

Quick fix: https://github.com/supabase/vault/issues/27#issuecomment-1984187441

For anyone coming accross this:

  • based on https://github.com/supabase/vault/issues/27#issuecomment-1804197388:
    • In your docker compose file:
# ...
  db:
    # ...
    volumes:
      # ...
      # pgsodium decryption key
      - ./volumes/db/pgsodium_root.key:/etc/postgresql-custom/pgsodium_root.key:Z

ghost avatar Mar 07 '24 18:03 ghost