Skip to content

Commit

Permalink
[Eng Runner] Delete Nango Connection on notion connector deletion (#2898
Browse files Browse the repository at this point in the history
)

Related [task](dust-tt/tasks#283)
  • Loading branch information
philipperolet authored Dec 15, 2023
1 parent 32ff1ca commit 27e311d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions connectors/src/connectors/notion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,28 @@ export async function cleanupNotionConnector(
transaction: transaction,
});

await deleteNangoConnection(connector.connectionId);

return new Ok(undefined);
});
}

async function deleteNangoConnection(connectionId: NangoConnectionId) {
if (!NANGO_NOTION_CONNECTOR_ID) {
throw new Error("NANGO_NOTION_CONNECTOR_ID not set");
}
const nangoRes = await nangoDeleteConnection(
connectionId,
NANGO_NOTION_CONNECTOR_ID
);
if (nangoRes.isErr()) {
logger.error(
{ err: nangoRes.error },
"Error deleting connection from Nango"
);
}
}

export async function retrieveNotionConnectorPermissions({
connectorId,
parentInternalId,
Expand Down

0 comments on commit 27e311d

Please sign in to comment.