diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java index e77cdb07d8..ca73be9f74 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/imports/internal/ImportApplicationServiceCEImpl.java @@ -523,7 +523,14 @@ public class ImportApplicationServiceCEImpl implements ImportApplicationServiceC // Start the stopwatch to log the execution time Stopwatch stopwatch = new Stopwatch(AnalyticsEvents.IMPORT.getEventName()); - final Mono importedApplicationMono = applicationSpecificImportedEntitiesMono + + /* + Calling the workspaceMono first to avoid creating multiple mongo transactions. + If the first db call inside a transaction is a Flux, then there's a chance of creating multiple mongo + transactions which will lead to NoSuchTransaction exception. + */ + final Mono importedApplicationMono = workspaceMono + .then(applicationSpecificImportedEntitiesMono) .then(getImportApplicationMono( importedApplication, importingMetaDTO, mappedImportableResourcesDTO, currUserMono)) .cache();