Skip to content

Commit 0c10bda

Browse files
committed
catch eager prisma connect
1 parent 807ef77 commit 0c10bda

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

apps/webapp/app/db.server.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,11 @@ function getClient() {
255255
queryPerformanceMonitor.onQuery("writer", log);
256256
});
257257

258-
// connect eagerly
259-
client.$connect();
258+
// Connect eagerly, catch any exception and log
259+
// Prisma will connect on use anyway
260+
client.$connect().catch((error) => {
261+
logger.error("Failed to eagerly connect prisma client (writer)", { error });
262+
});
260263

261264
console.log(`🔌 prisma client connected`);
262265

@@ -378,8 +381,11 @@ function getReplicaClient() {
378381
queryPerformanceMonitor.onQuery("replica", log);
379382
});
380383

381-
// connect eagerly
382-
replicaClient.$connect();
384+
// Connect eagerly, catch any exception and log
385+
// Prisma will connect on use anyway
386+
replicaClient.$connect().catch((error) => {
387+
logger.error("Failed to eagerly connect prisma client (replica)", { error });
388+
});
383389

384390
console.log(`🔌 read replica connected`);
385391

0 commit comments

Comments
 (0)