I am trying to run MedusaJS locally, I have installed PostgreSQL/Medusa, and when I try to run it I get the error:
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:399:5)
at URL.onParseError (node:internal/url:566:9)
at new URL (node:internal/url:646:5)
at parse (c:\repo\medusa-store\node_modules\pg-connection-string\index.js:29:14)
at new ConnectionParameters (c:\repo\medusa-store\node_modules\pg\lib\connection-parameters.js:56:42)
at new Client (c:\repo\medusa-store\node_modules\pg\lib\client.js:18:33)
at BoundPool.newClient (c:\repo\medusa-store\node_modules\pg-pool\index.js:213:20)
at BoundPool.connect (c:\repo\medusa-store\node_modules\pg-pool\index.js:207:10)
at c:\repo\medusa-store\node_modules\typeorm\driver\postgres\PostgresDriver.js:1163:18
at new Promise (<anonymous>) {
input: 'postgres://user:pass@host:port/db',
code: 'ERR_INVALID_URL'
Is this not the correct format for the connection string?
postgres://[user][:password]@[host][:port]/[dbname]
I have checked the documentation for medusa and that seems to be the expected format for the connection string.
there few things to consider when having an error related to
postgres
inmedusajs
or any database related error in medusa :DATABASE_URL
enviroment variable structure is valid from docs: