diff --git a/connectors/src/connectors/microsoft/temporal/activities.ts b/connectors/src/connectors/microsoft/temporal/activities.ts index aa5cde71644c..f4b080fcc198 100644 --- a/connectors/src/connectors/microsoft/temporal/activities.ts +++ b/connectors/src/connectors/microsoft/temporal/activities.ts @@ -1094,6 +1094,14 @@ async function scrubRemovedFolders({ const dataSourceConfig = dataSourceConfigFromConnector(connector); + logger.info( + { + connectorId: connector.id, + nodes: nodes.map((n) => n.toJSON()), + }, + "Scrubbing removed folders" + ); + for (const node of nodes) { if (node.nodeType === "file") { await deleteFile({ diff --git a/connectors/src/connectors/microsoft/temporal/file.ts b/connectors/src/connectors/microsoft/temporal/file.ts index 41995dfe8ac8..ea5166dfcb08 100644 --- a/connectors/src/connectors/microsoft/temporal/file.ts +++ b/connectors/src/connectors/microsoft/temporal/file.ts @@ -417,7 +417,10 @@ export async function deleteFolder({ ); if (root) { - await root.delete(); + // Roots represent the user selection for synchronization As such, they + // should be deleted first, explicitly by users, before deleting the + // underlying folder + throw new Error("Unexpected: attempt to delete folder with root node"); } if (folder) {