Skip to content

Commit 2239069

Browse files
committed
Fix SSL certificate issue for AWS RDS connections
1 parent 5822ca0 commit 2239069

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

apps/web/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
},
2121
"dependencies": {
2222
"@t3-oss/env-nextjs": "^0.13.8",
23-
"aws-ssl-profiles": "^1.1.2",
2423
"axios": "^1.10.0",
2524
"dotenv": "^17.1.0",
2625
"drizzle-orm": "^0.44.2",

apps/web/src/db/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import awsCaBundle from "aws-ssl-profiles";
21
import { drizzle } from "drizzle-orm/node-postgres";
32
import { Pool } from "pg";
43
import { env } from "../env";
@@ -7,8 +6,14 @@ import * as schema from "./schema";
76
// Create a connection pool using validated environment variables
87
const pool = new Pool({
98
connectionString: env.DATABASE_URL,
10-
// Use AWS CA bundle for SSL verification (we have proper certs in Docker)
11-
ssl: awsCaBundle,
9+
// For AWS RDS, we need to handle SSL differently in different environments
10+
ssl:
11+
process.env.NODE_ENV === "production"
12+
? {
13+
rejectUnauthorized: false, // AWS RDS uses self-signed certificates
14+
require: true, // But we still require SSL
15+
}
16+
: false,
1217
});
1318

1419
// Create the database instance

0 commit comments

Comments
 (0)