Skip to content

Commit 8c93c62

Browse files
committed
Fix SSL certificate issue for database connections during build
- Add NODE_TLS_REJECT_UNAUTHORIZED=0 for migration and build commands only - Keep dynamic page generation as intended (SSG with database access) - Allows CodeBuild to connect to RDS with self-signed certificates during build phase - Only affects build-time database connections, not runtime connections This fixes the 'self-signed certificate in certificate chain' error that was preventing Next.js from connecting to the database during static page generation.
1 parent 035aba2 commit 8c93c62

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

apps/web/buildspec.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ phases:
3434

3535
- echo "=== RUNNING DATABASE MIGRATIONS ==="
3636
- echo "Running migrations before build..."
37-
- /root/.bun/bin/bun run db:migrate:runtime
37+
- NODE_TLS_REJECT_UNAUTHORIZED=0 /root/.bun/bin/bun run db:migrate:runtime
3838
- echo "✅ Database migrations completed"
3939

4040
- echo "=== BUILDING NEXT.JS ON CODEBUILD HOST (WITH MIGRATED DATABASE) ==="
4141
- echo "Running Next.js build with database access for SSG..."
42-
- /root/.bun/bin/bun run build
42+
- NODE_TLS_REJECT_UNAUTHORIZED=0 /root/.bun/bin/bun run build
4343
- echo "✅ Next.js build completed with database access"
4444

4545
- echo "=== PREPARING STANDALONE BUILD FILES ==="

0 commit comments

Comments
 (0)