Prisma "P1000: Authentication failed against database server" in CI
P1000 means the server was reachable but rejected the credentials. In CI the username or password in DATABASE_URL does not match what the database service container was configured with.
What this error means
Prisma fails with "P1000: Authentication failed against database server at localhost, the provided database credentials for postgres are not valid."
Prisma
Error: P1000: Authentication failed against database server at `localhost`, the provided database credentials for `postgres` are not valid.
Please make sure to provide valid database credentials for the database server at `localhost`.Common causes
URL credentials do not match the service env
The service was started with one password and DATABASE_URL uses another, so authentication is rejected.
Special characters not URL-encoded in the password
A password with @, :, or / that is not percent-encoded breaks the URL and sends wrong credentials.
How to fix it
Match the URL to the service credentials
- Set the same user and password in the service
envand in DATABASE_URL. - Keep them in one place (a secret) so they cannot drift.
- Re-run once they agree.
.github/workflows/ci.yml
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: appuser
POSTGRES_PASSWORD: apppass
# DATABASE_URL=postgresql://appuser:apppass@localhost:5432/appURL-encode special characters
Percent-encode reserved characters in the password so the connection string parses correctly.
Terminal
# password "p@ss/word" becomes:
DATABASE_URL=postgresql://appuser:p%40ss%2Fword@localhost:5432/appHow to prevent it
- Define credentials once and reference them in both places.
- URL-encode any special characters in the password.
- Store the full connection string as a single secret.
Related guides
Prisma "P1001: Can't reach database server" (service not up) in CIFix Prisma "P1001: Can't reach database server at host:port" in CI - the database service has not started yet…
Prisma "P1003: Database does not exist" in CIFix Prisma "P1003: Database `app` does not exist on the database server" in CI - the target database named in…
Prisma "Environment variable not found: DATABASE_URL" in CIFix Prisma "Environment variable not found: DATABASE_URL" in CI - the datasource reads DATABASE_URL from the…