Medusa connect to db per instructions is not connecting

148 Views Asked by At

According to the documentation in two areas of the documentation: Configurations/database_url:

postgres://[user][:password]@[host][:port]/[dbname]

You set the database url like so:

module.exports = {
  projectConfig: {
    database_url: process.env.DATABASE_URL,
    // ...
  },
  // ...
}

You can also Create Medusa App like so:

npx create-medusa-app@latest --db-url postgres://[user][:password]@[host][:port]/[dbname]

When I run either of the above with those exact settings:

npx create-medusa-app@latest --db-url postgres://impctUsr:[email protected]:5432/impactcolorDB

I get the errors: Couldn't connect to PostgreSQL using the database URL you passed. Make sure it's correct and try again. or when just trying to migrate and having it configured in the .env

[![TypeError [ERR_INVALID_URL]: Invalid URL: postgres://impctUsr:[email protected]:5432/impactcolorDB][1]][1]

I can confirm that the credentials work from a local client connection. [1]: https://i.stack.imgur.com/vcbm3.png

1

There are 1 best solutions below

0
On

Resolved by help from @shahednasser: The password had special characters so I removed them. I also added quotations around the string.

npx create-medusa-app@latest --db-url "postgres://impctUsr:[email protected]:5432/impactcolorDB"