diff --git a/server/plugins/migrations.ts b/server/plugins/migrations.ts index 2784fdc5..5f992549 100644 --- a/server/plugins/migrations.ts +++ b/server/plugins/migrations.ts @@ -35,6 +35,10 @@ class MultiFolderMigrationProvider implements MigrationProvider { } export default defineNitroPlugin(async () => { + // Skip during build-time prerender — the builder isn't attached to the VPC, + // so connecting to the private DB host would time out. Migrations run at runtime. + if (import.meta.prerender) return + const cfg = useRuntimeConfig() const databaseUrl = cfg.databaseUrl || process.env.DATABASE_URL if (!databaseUrl) { diff --git a/server/utils/database.ts b/server/utils/database.ts index 8c8bfcbd..471036f3 100644 --- a/server/utils/database.ts +++ b/server/utils/database.ts @@ -17,7 +17,7 @@ function getDb(): Kysely { dialect: new PostgresJSDialect({ postgres: postgres(databaseUrl, { ssl: isLocal ? false : 'require', - max: 10, + max: 5, idle_timeout: 20, connect_timeout: 30, onnotice: () => {},