`unable to run migrations" error="parse \"postgres://postgres:d+]pa>\": invalid port \":d+]pa>\" after host"
Turns out that in initializeDB() we re-construct the connection URL from scratch (instead of using the value passed in. So, even if the caller provides a password that is correctly encoded, the connection URL used to execute migrations is not. This is also a little problematic with sslMode if it's not specified in the initial URL.
Most importantly, this introduces a bug.
in the code that reconstructs the URL, each parameter should be URL encoded. Realistically, the password is the most important, in it's current form you can't have the # or : characters in passwords. This is a pain because AWS likes to generate passwords for the databases and you can't modify them.
I got this somewhat mystifying error:
`unable to run migrations" error="parse \"postgres://postgres:d+]pa>\": invalid port \":d+]pa>\" after host"
Turns out that in
initializeDB()
we re-construct the connection URL from scratch (instead of using the value passed in. So, even if the caller provides a password that is correctly encoded, the connection URL used to execute migrations is not. This is also a little problematic withsslMode
if it's not specified in the initial URL.Most importantly, this introduces a bug.
in the code that reconstructs the URL, each parameter should be URL encoded. Realistically, the password is the most important, in it's current form you can't have the
#
or:
characters in passwords. This is a pain because AWS likes to generate passwords for the databases and you can't modify them.I recommend: