Skip to content

Sqlx says that a Postgres URL is incorrect, but when I connect with psql it works perfectly. #3504

Answered by abonander
KOEGlike asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, looking closer it's not likely an issue with URL-encoding.

I'm still not sure exactly what's going wrong, but I can tell you your .env file is the wrong format. It's not a shell script, you don't need export before each variable. It's just a list of key-value pairs: https://docs.docker.com/reference/compose-file/services/#env_file-format

However, I think that would just give you a "wrong password" error if it fails to parse the .env file, because POSTGRES_PASSWORD would not be set.

My current best guess has to do with how you're actually passing DATABASE_URL to the service:

environment:
       - DATABASE_URL="postgresql://jammer:${POSTGRES_PASSWORD}@jam_db:5432/jam_db"

There's no in…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@KOEGlike
Comment options

@KOEGlike
Comment options

@abonander
Comment options

Answer selected by KOEGlike
@KOEGlike
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants