When attempting to use Sequelize CLI to connect to a PostgreSQL database, an issue arises if the database password contains a colon (':') symbol. The CLI does not handle this special character correctly, causing authentication failures.
I'm using the Sequelize db:migration with and without --url and in both scenarios, Sequelize could authenticate to the database with the same password but sequelize-cli can not connect to run migrations and seeds.
In the file config-helper.js at line 174, we've identified that the
const urlParts = url.parse(urlString);
statement is responsible for decoding encoded URL symbols, including the colon (':').
Due to the following code at line 186, which is
password: urlParts.auth.split(':')[1],
characters in the password field after the colon (':') will be ignored.
When attempting to use Sequelize CLI to connect to a PostgreSQL database, an issue arises if the database password contains a colon (':') symbol. The CLI does not handle this special character correctly, causing authentication failures.
I'm using the
Sequelize db:migrationwith and without--urland in both scenarios, Sequelize could authenticate to the database with the same password butsequelize-clican not connect to run migrations and seeds.In the file
config-helper.jsat line 174, we've identified that theconst urlParts = url.parse(urlString);statement is responsible for decoding encoded URL symbols, including the colon (':').
Due to the following code at line 186, which is
password: urlParts.auth.split(':')[1],characters in the password field after the colon (':') will be ignored.