Closed MCode-Team closed 1 week ago
Hey @MCode-Team, can you share what your DATABASE_URL
looks like? do redact the auth credentials before you do
Hey @MCode-Team, can you share what your
DATABASE_URL
looks like? do redact the auth credentials before you do
Hey @riqwan , I can now connect to RDS database on DigitalOcean. by setting
set NODE_TLS_REJECT_UNAUTHORIZED=0
export NODE_TLS_REJECT_UNAUTHORIZED=0
// Set this at the very beginning of your application process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
Share Full Code in file #medusa-config.js // Set this at the very beginning of your application process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
// Your existing code follows const { QUOTE_MODULE } = require("./src/modules/quote"); const { loadEnv, defineConfig, Modules } = require("@medusajs/framework/utils");
loadEnv(process.env.NODE_ENV || 'development', process.cwd())
const fs = require('fs'); const path = require('path');
module.exports = defineConfig({ projectConfig: { databaseUrl: process.env.DATABASE_URL, databaseOptions: { ssl: { rejectUnauthorized: process.env.NODE_ENV === 'production' ? true : false, // Allow self-signed in development ca: process.env.DATABASE_SSL_CERT ? fs.existsSync(path.join(dirname, process.env.DATABASE_SSL_CERT)) ? fs.readFileSync(path.join(dirname, process.env.DATABASE_SSL_CERT)) : undefined : undefined, // Handle missing file }, }, 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", }, }, modules: { companyModuleService: { resolve: "./modules/company", },
resolve: "./modules/quote",
},
[Modules.CACHE]: {
resolve: "@medusajs/medusa/cache-inmemory",
},
[Modules.WORKFLOW_ENGINE]: {
resolve: "@medusajs/medusa/workflow-engine-inmemory",
},
}, });
Sounds good!
To make it work with the config, what you need is actually this (I just noticed your option names are wrong):
projectConfig: {
databaseUrl: `postgres://test:test@test:5432/test?sslmode=require`,
databaseDriverOptions: {
connection: {
ssl: {
rejectUnauthorized: true,
ca: fs.existsSync(
path.join(__dirname, process.env.DATABASE_SSL_CERT)
),
},
},
},
Feel free to reopen if you come across more issues! 🤞🏻
I can't connect rds database digitalocean
medusa-config.js
const { QUOTE_MODULE } = require("./src/modules/quote"); const { loadEnv, defineConfig, Modules } = require("@medusajs/framework/utils");
loadEnv(process.env.NODE_ENV || 'development', process.cwd())
const fs = require('fs'); const path = require('path');
module.exports = defineConfig({ projectConfig: { databaseUrl: process.env.DATABASE_URL, databaseOptions: { ssl: process.env.NODE_ENV === 'production' ? { rejectUnauthorized: true, ca: fs.readFileSync(path.join(__dirname, process.env.DATABASE_SSL_CERT)), } : { rejectUnauthorized: false, }, }, 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", }, }, modules: { companyModuleService: { resolve: "./modules/company", },
}, });