-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: npx medusa db:setup fails #10105
Comments
Do you sure you have correct postgresql URL and it's ready to connect ? And show your medusa-config.ts file |
Yes, actually I've tried npx create-medusa-app@latest --db-url "postgresql://postgres.user:[email protected]:PORT/postgres" and it works (the medusa-config.ts➜ my-medusa-store-skipping-db cat medusa-config.ts
import { loadEnv, defineConfig } from '@medusajs/framework/utils'
loadEnv(process.env.NODE_ENV || 'development', process.cwd())
module.exports = defineConfig({
projectConfig: {
databaseUrl: process.env.DATABASE_URL,
http: {
storeCors: process.env.STORE_CORS!,
adminCors: process.env.ADMIN_CORS!,
authCors: process.env.AUTH_CORS!,
jwtSecret: process.env.JWT_SECRET || "supersecret",
cookieSecret: process.env.COOKIE_SECRET || "supersecret",
}
}
}) |
Let's try connect DB by command line first: to make sure your postgresql url is correct .
By the way, make sure there is no space on your .env parameter's value |
I did verify the connection before :( , what really surprises me is that this one works!
|
The error message does indeed suggest an issue with the PG connection. Someone reported a similar scenario with a Supabase connection string here. This is worth a shot! |
To be honest, I don’t think the issue is with the connection. As you can see in the first log: info: Connection established with the database "postgres" I also tried the solution mentioned in that post, but it still didn’t work (same error). I found it strange that when running |
Package.json file
Node.js version
v20.11.1
Database and its version
PostgreSQL 15.6 on aarch64-unknown-linux-gnu, compiled by gcc (GCC) 13.2.0, 64-bit
Operating system name and version
MacOs 15.1 (24B83)
Browser name
Safari
What happended?
First create a new project skipping the bd creation
when trying to initiate the BD, the commands fails. (I added the
DATABASE_URL
to the .env file)Expected behavior
Create database
Actual behavior
Fails
Link to reproduction repo
not apply
The text was updated successfully, but these errors were encountered: