Skip to content

Commit a08b451

Browse files
committed
fix(dashboard-api): handle transaction buffering timeouts
- Relaxed the isTransactionError strict check to also catch 'buffering timed out' and generic 'Session' or 'sessions are not supported' errors. - This ensures that when MongoDB instances (e.g., standalone setups) fail to start a session due to missing replica set configuration, the transaction gracefully falls back to the non-transactional operation instead of crashing with a 500.
1 parent 95e72c1 commit a08b451

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

apps/dashboard-api/src/controllers/project.controller.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,12 @@ module.exports.createProject = async (req, res) => {
389389
session.endSession();
390390
}
391391

392-
const isTransactionError = err.message &&
393-
err.message.includes("Transaction numbers are only allowed") &&
394-
(err.code === 20 || err.codeName === 'IllegalOperation');
392+
const isTransactionError = err.message && (
393+
(err.message.includes("Transaction numbers are only allowed") && (err.code === 20 || err.codeName === 'IllegalOperation')) ||
394+
err.message.includes("buffering timed out") ||
395+
err.message.includes("Session") ||
396+
err.message.includes("sessions are not supported")
397+
);
395398

396399
if (isTransactionError) {
397400
try {

0 commit comments

Comments
 (0)