Skip to content

Auth method failed #913

Closed
Closed
@felipe-heredia

Description

@felipe-heredia

I'm try to deploy my app with postgres, but I gotten this error:

postgres_1  | 2021-12-03 23:24:15.438 UTC [33] FATAL:  password authentication failed for user "postgres"
postgres_1  | 2021-12-03 23:24:15.438 UTC [33] DETAIL:  Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"

I've see #911 and see postgres:14 have an auth bug, I think.

My docker-compose

  postgres:
    image: postgres:latest
    env_file:
      - .env
    container_name: jano_postgres
    ports:
      - ${DB_PORT}:${DB_PORT}
    restart: always
    volumes:
      - postgres:/var/lib/postgresql/data

Error from my prisma (using to connect to db)

PrismaClientInitializationError: Authentication failed against database server at `jano_postgres`, the provided database credentials for `postgres` are not valid.

My .env

# POSTGRES
POSTGRES_USER="postgres"
POSTGRES_PASSWORD="admin"
POSTGRES_DB="holdbtc100"

# Nest run locally
#DB_HOST=localhost
# Nest run in docker, change host to database container name
DB_HOST="jano_postgres"
DB_PORT="5432"

# Prisma database connection
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}"
SECRET_KEY="secretKeyToDev"

I don't know the why, but this .env work on my local machine (created 2 months ago), but in the EC2 machine no.

I need this for yesterday, if you know how I can solve (if postgres:13 or another mode) tell me, please

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions