peppermint
peppermint copied to clipboard
Prisma Error P1013
I am running the dockerized version. The application is not connecting to the database / running migrations apparently.
eppermint | Environment variables loaded from .env peppermint | Prisma schema loaded from src/prisma/schema.prisma peppermint | Datasource "db": PostgreSQL database peppermint | {"level":50,"time":1711761602379,"pid":148,"hostname":"8c3de868bbd6","err":{"type":"Error","message":"Command failed: npx prisma migrate deploy\nError: P1013: The provided database string is invalid. empty host in database URL. Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.\n","stack":"Error: Command failed: npx prisma migrate deploy\nError: P1013: The provided database string is invalid. empty host in database URL. Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.\n\n at ChildProcess.exithandler (node:child_process:422:12)\n at ChildProcess.emit (node:events:518:28)\n at maybeClose (node:internal/child_process:1105:16)\n at ChildProcess._handle.onexit (node:internal/child_process:305:5)","code":1,"killed":false,"signal":null,"cmd":"npx prisma migrate deploy"},"msg":"Command failed: npx prisma migrate deploy\nError: P1013: The provided database string is invalid. empty host in database URL. Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.\n"}
can you provide an example of your docker-compose?
can you provide an example of your docker-compose?
I'm using the one provided on docs, just changed password and API URL.
if you do docker ps -a, is postgres container running for you? @jvdutrag if not check docker logs postgres, it might say not enough space
The error message sounds like the database host is empty.
The provided database string is invalid. empty host in database URL.
I also had a similar problem on the npx prisma migrate ... command but it was P102X (big dumb dumb me did not have it anymore... but a DB thing also) but after some tinkering, I created a apps/api/.env file in with the following content :
DB_USERNAME=user
DB_PASSWORD=pass
DB_HOST=peppermint_db_service_in_docker_file
DB_NAME=peppermint
DATABASE_URL=postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}
and npx prisma commands started working.
As for why'd they need to be configured for me ... :no_good_man: but maybe it helps you narrow it down :smile:
Note that didn't test this explicitly, I just hard coded the DATABASE_URL...
@DimitriGilbert was this in docker?
yes, it was in a docker compose stack
Same issue here. Installed on Dockge (Portainer equivalent). Using standard Docker-compose file.