supabase / supavisor

A cloud-native, multi-tenant Postgres connection pooler.

Home Page:https://supabase.github.io/supavisor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to create tenant.

chethankumar4046 opened this issue · comments

Bug report

Describe the bug

Not able to create tenant. using CURL command

To Reproduce

  • I have deployed supabase/supavisor as a docker container (0.9.24)

  • I have postgres running as docker container

  • I am running CURL request to create new tenant but i am getting error

Expected behavior

New tenant should be created

Curl request

curl -X PUT \ 'http://localhost:4000/api/tenants/dev_tenant' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJyb2xlIjogImFub24iLAogICJpc3MiOiAic3VwYWJhc2UiLAogICJpYXQiOiAxNjk5MjA5MDAwLAogICJleHAiOiAxODU3MDYxODAwCn0.hRUobXyQbZD2r9ElrQmVe437aAnyBV0j2aJATvCIjYA' \ --header 'Content-Type: application/json' \ --data '{ "tenant": { "db_host": "localhost", "db_port": 5432, "db_database": "supavisortest", "ip_version": "auto", "require_user": "true", "default_max_clients": 200, "default_pool_size": 15, "users": [ { "db_user": "supavisorTest", "db_password": "supavisorTest", "mode_type": "transaction", "pool_checkout_timeout": 100, "pool_size": 10 } ] } }'

Curl response

response.txt

Server log

`09:34:28.379 [info] Sent 500 in 1194ms file=lib/phoenix/logger.ex line=231 pid=<0.4600.0>
09:34:28.380 [error] #PID<0.4600.0> running Phoenix.Endpoint.SyncCodeReloadPlug (connection #PID<0.4599.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: PUT /api/tenants/dev_tenant
** (exit) an exception was raised:
** (ErlangError) Erlang error: {:badarg, {'aead.c', 63}, 'non-binary key'}:

  • 2nd argument: non-binary key

    (crypto 5.1.3) crypto.erl:985: :crypto.crypto_one_time_aead(:aes_256_gcm, nil, <<35, 70, 38, 86, 86, 154, 122, 82, 248, 45, 226, 155, 79, 149, 104, 146>>, "supavisor", "AES256GCM", 16, true)
    (cloak 1.1.2) lib/cloak/ciphers/aes_gcm.ex:47: Cloak.Ciphers.AES.GCM.encrypt/2
    (supavisor 0.9.26) lib/cloak_ecto/type.ex:37: Supavisor.Encrypted.Binary.dump/1
    (ecto 3.10.3) lib/ecto/type.ex:931: Ecto.Type.process_dumpers/3
    (ecto 3.10.3) lib/ecto/repo/schema.ex:1015: Ecto.Repo.Schema.dump_field!/6
    (ecto 3.10.3) lib/ecto/repo/schema.ex:1028: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
    (stdlib 4.3) maps.erl:411: :maps.fold_1/3
    (ecto 3.10.3) lib/ecto/repo/schema.ex:1026: Ecto.Repo.Schema.dump_fields!/5
    (ecto 3.10.3) lib/ecto/repo/schema.ex:960: Ecto.Repo.Schema.dump_changes!/7
    (ecto 3.10.3) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    (ecto 3.10.3) lib/ecto/association.ex:815: Ecto.Association.Has.on_repo_change/5
    (ecto 3.10.3) lib/ecto/association.ex:573: anonymous fn/8 in Ecto.Association.on_repo_change/7
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto 3.10.3) lib/ecto/association.ex:569: Ecto.Association.on_repo_change/7
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto 3.10.3) lib/ecto/association.ex:533: Ecto.Association.on_repo_change/4
    (ecto 3.10.3) lib/ecto/repo/schema.ex:926: Ecto.Repo.Schema.process_children/5
    (ecto 3.10.3) lib/ecto/repo/schema.ex:1004: anonymous fn/3 in Ecto.Repo.Schema.wrap_in_transaction/6
    (ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:1352: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
    (db_connection 2.5.0) lib/db_connection.ex:1630: DBConnection.run_transaction/4 pid=<0.4599.0>`