skunkwerk
skunkwerk

Reputation: 3070

supabase cannot connect to database

I've done a fresh install of Supabase via docker compose following this example into my Ubuntu 20.04 server. When I run docker-compose up everything works except I see this error in my logs:

supabase-rest | 21/Feb/2022:19:50:29 +0000: {"details":"could not translate host name \"l@db\" to address: Name does not resolve\n","code":"","message":"Database connection error. Retrying the connection."}

How do I fix this?

Upvotes: 1

Views: 4702

Answers (1)

Awalias
Awalias

Reputation: 2127

Looking at this section in the docker-compose.yml:

  rest:
    container_name: supabase-rest
    image: postgrest/postgrest:v9.0.0
    depends_on:
      - db
    restart: unless-stopped
    environment:
      PGRST_DB_URI: postgres://postgres:${POSTGRES_PASSWORD}@db:5432/postgres

It's possible that the password you used in .env is not being escaped correctly - does it contain special chars?

Note that they need to be URI encoded if so as per: How to handle special characters in the password of a Postgresql URL connection string?

Upvotes: 1

Related Questions