Skip to content

Sequelize CLI Fails to Authenticate with Postgres DB Containing a ':' in Password #1388

@hrabizadeh-sa

Description

@hrabizadeh-sa

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions