Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/medusa/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ WORKDIR /app/server

ENV PORT=80

CMD ["sh", "-c", "yarn migrate:prod && yarn start:prod"]
CMD ["yarn", "start:prod"]
6 changes: 4 additions & 2 deletions apps/medusa/medusa-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ loadEnv(process.env.NODE_ENV || 'development', process.cwd());
const REDIS_URL = process.env.REDIS_URL;
const STRIPE_API_KEY = process.env.STRIPE_API_KEY;
const IS_TEST = process.env.NODE_ENV === 'test';
const DATABASE_URL = process.env.DATABASE_URL;
const DATABASE_USES_SSL = DATABASE_URL?.includes('sslmode=require') || process.env.DATABASE_SSL === 'true';

const cacheModule = IS_TEST
? { resolve: '@medusajs/medusa/cache-inmemory' }
Expand Down Expand Up @@ -37,9 +39,9 @@ const workflowEngineModule = IS_TEST

module.exports = defineConfig({
projectConfig: {
databaseUrl: process.env.DATABASE_URL,
databaseUrl: DATABASE_URL,
databaseDriverOptions: {
ssl: false,
ssl: DATABASE_USES_SSL ? { rejectUnauthorized: false } : false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Nest the SSL option under connection

Medusa 2.x expects PostgreSQL driver SSL options under databaseDriverOptions.connection.ssl (the official example uses { connection: { ssl: ... } }, not a top-level ssl: https://docs.medusajs.com/learn/configurations/medusa-config#databasedriveroptions). With this option left at the top level, DATABASE_SSL=true or a Railway URL that trips DATABASE_USES_SSL still won't apply rejectUnauthorized: false, so deployments against SSL-required/self-signed Postgres can continue to fail during startup. Please nest both the enabled and disabled cases under connection so the pg driver receives them.

Useful? React with 👍 / 👎.

},
redisUrl: REDIS_URL,

Expand Down
Loading