supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.02k stars 201 forks source link

- character in project name breaks docker pull #2288

Closed eRuaro closed 3 months ago

eRuaro commented 4 months ago

Describe the bug Supabase CLI keeps on pulling postgres version 15.1.0.73. even though I'm explicitly adding in version 15.1.1.4 on my .temp dir.

To Reproduce I ran two experiments to reproduce this: Here are my experiments. All involved removing the docker images before running supabase init.

First experiment:

$ supabase init
$ supabase start

This will pull the docker images and specifically will pull postgres with version 15.1.0.73.

Second experiment:

$ supabase init
// the command below will add version variables to the .temp directory for the supabase services. One of which will be version 15.1.1.44 for postgres
$ supabase link --project-ref my-supabase-cloud-proj --password my-db-password
$ supabase start

Both of these experiments still yielded in supabase CLI installing postgres with version 15.1.0.73.

Expected behavior CLI will pull postgres with version 15.1.1.4

Additionally, running supabase services gives the following:

❯ npx supabase@beta services

        SERVICE IMAGE      │        LOCAL         │  LINKED
  ─────────────────────────┼──────────────────────┼────────────
    supabase/postgres      │ 15.1.1.44            │ 15.1.1.44
    supabase/gotrue        │ v2.151.0             │ v2.151.0
    postgrest/postgrest    │ v12.0.2              │ v12.0.2
    supabase/realtime      │ v2.28.32             │ -
    supabase/storage-api   │ v1.2.1               │ v1.2.1
    supabase/edge-runtime  │ v1.49.0              │ -
    supabase/studio        │ 20240506-2976cd6     │ -
    supabase/postgres-meta │ v0.80.0              │ -
    supabase/logflare      │ 1.4.0                │ -
    bitnami/pgbouncer      │ 1.20.1-debian-11-r39 │ -
    darthsim/imgproxy      │ v3.8.0               │ -

There's a mismatch on what's being outputted by the CLI, to the docker images being used.

Additional context Having an outdated postgres version doesn't allow developers to have access to updated extensions. On my end, it means I don't have access to the updated versions of the vector extension. On postgres 15.1.0.73, I only have access to vector version 4 which does not have the HNSW index. This means I can't replicate my cloud setup anymore on my local environment.

sweatybridge commented 4 months ago

Could it be that you have multiple installations of cli locally? Have you tried npx supabase start?

eRuaro commented 4 months ago

No, both experiments had me remove all the docker images prior to running npx supabase init.

sweatybridge commented 4 months ago

What does npx supabase --version say? The only place we hardcode postgres version is in older version of cli.

Perhaps you can also try npx supabase@latest start

eRuaro commented 4 months ago

CLI is on: 1.167.4. The latest one

I deleted all my supabase related docker images again and ran npx supabase@latest start but it only downloaded postgres version 15.1.1.41 and not the other supabase services and errored out with database not healthy.

sweatybridge commented 4 months ago

it only downloaded postgres version 15.1.1.41 and not the other supabase services and errored out with database not healthy

That looks like a new error similar to https://github.com/supabase/cli/issues/2287

I'm unable to reproduce it on gitpod though. Could you show me the logs of database container? And may be remove any existing docker volumes with npx supabase@latest stop --no-backup

eRuaro commented 4 months ago

Nawp. Same issue, only getting postgres docker image. Even did docker system prune --all --force

sweatybridge commented 4 months ago

Do you mean it's not even downloading other service images like auth and storage? Are there logs?

If it's a registry problem, you can try a different registry with SUPABASE_INTERNAL_IMAGE_REGISTRY=docker.io supabase start

eRuaro commented 4 months ago

Got it working now, it was a directory name issue. Thanks!

sweatybridge commented 4 months ago

Good to hear. What was the problematic directory name? Perhaps I can update cli to handle it better.

eRuaro commented 4 months ago

It was an invalid project name for the docker images. So I had an invalid character, specifically I had -. I was able to run supabase on the project before though even when it had the - in the name. I just renamed it and removed the - character.