evolution-api icon indicating copy to clipboard operation
evolution-api copied to clipboard

❗ ENV variables like DATABASE_URL and DATABASE_PROVIDER are ignored by container due to internal .env override

Open StbanMc opened this issue 8 months ago • 0 comments

Welcome!

  • [x] Yes, I have searched for similar issues on GitHub and found none.

What did you do?

Bug Report

Describe the problem

The official image atendai/evolution-api (tested on tags v2.2.3, v2.1.1, and homolog) completely ignores externally defined environment variables such as DATABASE_URL and DATABASE_PROVIDER.

Even when correctly passed using:

  • environment: block
  • env_file:
  • or mounting a custom .env file with volumes: ./myenv:/usr/src/app/.env

…the container still attempts to connect using:

What did you expect?

I expected the container to respect externally defined environment variables, such as DATABASE_URL, DATABASE_PROVIDER, and AUTHENTICATION_API_KEY, when passed via Docker Compose or the Docker CLI.

These variables should override any internal .env configuration by default, following standard containerization practices.

What did you observe instead of what you expected?

Despite correctly passing the environment variables using environment: or env_file: in Docker Compose, the container still connects using the default credentials (user:pass@localhost) defined in its internal .env file.

This results in repeated Prisma authentication errors like:

P1000: Authentication failed against database server atpostgres, the provided credentials for user are not valid.

The container completely ignores the custom DATABASE_URL and DATABASE_PROVIDER values, even when the internal .env is explicitly overridden via bind mount.

Screenshots/Videos

No response

Which version of the API are you using?

atendai/evolution-api:v2.2.3

atendai/evolution-api:v2.1.1

atendai/evolution-api:homolog

What is your environment?

Windows

Other environment specifications

  • Host OS: Ubuntu Server 24.04 LTS - Deployment: Docker Compose - Tested on both local and cloud (AWS EC2) environments with the same result.

If applicable, paste the log output

Environment variables loaded from .env Prisma schema loaded from prisma/postgresql-schema.prisma Datasource "db": PostgreSQL database "evolution", schema "public" at "postgres:5432"

Error: P1000: Authentication failed against database server at postgres, the provided database credentials for user are not valid.

Please make sure to provide valid database credentials for the database server at postgres. Error executing command: rm -rf ./prisma/migrations && cp -r ./prisma/postgresql-migrations ./prisma/migrations && npx prisma migrate deploy --schema ./prisma/postgresql-schema.prisma Migration failed Deploying migrations for postgresql Database URL: postgresql://evolution_user:evolution_pass@postgres:5432/evolution

[email protected] db:deploy node runWithProvider.js "rm -rf ./prisma/migrations && cp -r ./prisma/DATABASE_PROVIDER-migrations ./prisma/migrations && npx prisma migrate deploy --schema ./prisma/DATABASE_PROVIDER-schema.prisma"

Environment variables loaded from .env Prisma schema loaded from prisma/postgresql-schema.prisma

Additional Notes

No response

StbanMc avatar May 20 '25 05:05 StbanMc