T
Twenty2mo ago
Taldres

PG_DATABASE_URL validation

Hey! I'm migrating from 0.31 to 0.32 and got some validation errors for PG_DATABASE_URL.
worker-1 | Error: An instance of EnvironmentVariables has failed the validation:
worker-1 | - property PG_DATABASE_URL has failed the following constraints: isUrl
server-1 | Error: An instance of EnvironmentVariables has failed the validation:
server-1 | - property PG_DATABASE_URL has failed the following constraints: isUrl
worker-1 | Error: An instance of EnvironmentVariables has failed the validation:
worker-1 | - property PG_DATABASE_URL has failed the following constraints: isUrl
server-1 | Error: An instance of EnvironmentVariables has failed the validation:
server-1 | - property PG_DATABASE_URL has failed the following constraints: isUrl
I've defined all relevant env vars. Did I forget something? .env
PG_DATABASE_HOST=db:5432
PGUSER_SUPERUSER=postgres
PGPASSWORD_SUPERUSER=removed
PG_DATABASE_HOST=db:5432
PGUSER_SUPERUSER=postgres
PGPASSWORD_SUPERUSER=removed
I use docker compose with the updated docker-compose.yml:
...
PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-twenty}@${PG_DATABASE_HOST:-db:5432}/default
...
...
PG_DATABASE_URL: postgres://${PGUSER_SUPERUSER:-postgres}:${PGPASSWORD_SUPERUSER:-twenty}@${PG_DATABASE_HOST:-db:5432}/default
...
2 Replies
thomast
thomast2mo ago
where did you find those vars? https://twenty.com/developers/section/self-hosting/self-hosting-var for env variables did you setup PG_DATABASE_URL in your env file?
Taldres
TaldresOP2mo ago
Thanks for your quick response @thomast 🙂 I am using a compose-override.yml due to my Traefik setup. However, during the migration, I accidentally followed the docker-compose.yml from the main branch. The environment variable was structured accordingly there. I also tried setting the PG_DATABASE_URL in the .env file using the previous password. However, the same error occurred there as well. In the meantime, I found the error. It was because my password contained special characters, which apparently caused the isUrl validation to fail. As a result, I had to completely set up the database fresh and assign an alphanumeric password to successfully pass the validation. Now everything works fine. I restored the data from my daily backups.
Want results from more Discord servers?
Add your server