From 43a4b0dc852725b86ab1fd5fa00da513d6d73772 Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Thu, 12 Feb 2026 10:32:08 +0200 Subject: [PATCH] fix: await mongoose.connect to properly catch connection errors --- gasless-v2-trading-bot/src/db/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gasless-v2-trading-bot/src/db/index.ts b/gasless-v2-trading-bot/src/db/index.ts index 759c8cd2..c5b42716 100644 --- a/gasless-v2-trading-bot/src/db/index.ts +++ b/gasless-v2-trading-bot/src/db/index.ts @@ -19,7 +19,7 @@ import Trade from './models/model.trade'; * @throws Will terminate the process if the database URI is not defined or if the connection attempt fails. */ -const connect = (): void => { +const connect = async (): Promise => { const dbUri = url; if (!dbUri) { @@ -29,7 +29,7 @@ const connect = (): void => { try { mongoose.set('strictQuery', false); - mongoose.connect(dbUri, { + await mongoose.connect(dbUri, { retryWrites: true, w: 'majority', });