bitnami / charts

Bitnami Helm Charts
https://bitnami.com
Other
8.56k stars 8.94k forks source link

[bitnami/supabase] Converted error {:badarg, {'api_ng.c', 228}, 'Bad key'} to 500 response #26618

Open AntonOfTheWoods opened 2 weeks ago

AntonOfTheWoods commented 2 weeks ago

Name and Version

bitnami/supabase 5.2.0

What architecture are you using?

amd64

What steps will reproduce the bug?

  1. in an isolated k3d environment with Kubernetes 1.29.4
  2. Use the provided values.yaml override.
  3. Attempt to add a tenant to use with realtime
  4. See an error and be unable to create a tenant

If one doesn't create a tenant, then attempts to use the realtime system fails with "unable to find tenant [container-name]".

Are you using any custom parameters or values?

publicURL: "http://supabase.localhost"
auth:
  extraEnvVars:
    - name: API_EXTERNAL_URL
      value: "http://supabase.localhost"
kong:
  service:
    type: ClusterIP
  ingress:
    enabled: true
    hostname: supabase.localhost
    ingressClassName: nginx
studio:
  publicURL: "http://supabase-studio.localhost"
  ingress:
    hostname: supabase-studio.localhost
    enabled: true
    ingressClassName: nginx

What is the expected behavior?

The realtime api should allow for the creation of realtime tenants.

What do you see instead?

curl -X POST \
  -H 'Content-Type: application/json' \
  --header 'Authorization: Bearer the_service_jwt' \
  -d $'{
    "tenant" : {
      "name": "test-supabase-realtime",
      "external_id": "test-supabase-realtime",
      "jwt_secret": "your-super-secret-jwt-token-with-at-least-32-characters-long",
      "extensions": [
        {
          "type": "postgres_cdc_rls",
          "settings": {
            "db_name": "postgres",
            "db_host": "test-supabase-db",
            "db_user": "supabase_admin",
            "db_password": "example123456",
            "db_port": "5432",
            "region": "us-west-1",
            "poll_interval_ms": 100,
            "poll_max_record_bytes": 1048576
          }
        }
      ]
    }
  }' \
  http://test-supabase-realtime/api/tenants

From the realtime logs:

Converted error {:badarg, {'api_ng.c', 228}, 'Bad key'} to 500 response

Additional information

This is true both with the default version for the chart (2.28.40-debian-12-r1) and the latest provided bitnami container (2.29.3-debian-12-r0). Trying to use the same versions of the supabase-provided realtime containers works with both their docker compose and the supabase-community chart.

As there is no documentation on how to do this for this particular chart, the only possible documentation source is the original supabase/realtime repo.

If one attempts to use the built-in "seed" functionality (that creates a realtime-dev tenant) as is done when running the upstream-provided container image in their compose file, i.e,:

realtime eval Realtime.Release.migrate && realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && realtime start

Then exactly the same error appears.

AntonOfTheWoods commented 2 weeks ago

The issue is due to the fact that there is no DB_ENC_KEY environment variable defined for the realtime container. The value is OBLIGATORY (and there is no default) if you are going to create tenants, and without tenants realtime is now useless (maybe they weren't required previously?).

I would submit a PR but previously wasted well over an hour trying to get your contributor agreement validated and it did not succeed, so I'll leave further PRs to your validated selves.