Mongodb Transactions Unhandled Promise Rejection Error - MongoError: Retryable write with is prohibited on session

Using Mongodb transactions with withTransaction Helper in nodejs (nestjs framework), These errors are popping up

UnhandledPromiseRejectionWarning: MongoError: Retryable write with txnNumber 3552 is prohibited on session 8a19417e-8bbd-46c5-9aab-04a2cb60f406 - /C5A+ZfCloKsJhH+D
aIABeIyRV1uALaRfamlKu9yI5I= because a newer retryable write with txnNumber 3553 has already started on this session.

at MessageStream.messageHandler (/home/ubuntu/project/node_modules/mongodb/lib/cmap/connection.js:263:20) 
at MessageStream.emit (events.js:315:20)
at processIncomingData (/home/ubuntu/project/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
at MessageStream._write(/home/project/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at MessageStream.Writable.write (_stream_writable.js:318:11)

Can anyone help me with what it means, or point me to any resources explaining this, there is very limited documentation for this particular error.

Sounds like the code doesn’t wait for X to finish before starting Y and then X can’t finish.
Asynchronicity is a harsh discipline :slight_smile: