Skip to content

Commit

Permalink
[connector] fix: force delete of slack connector (#5895)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier authored Jun 26, 2024
1 parent 0f4123b commit 81eef6f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions connectors/src/connectors/slack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ export async function uninstallSlack(nangoConnectionId: string) {
}

export async function cleanupSlackConnector(
connectorId: ModelId
connectorId: ModelId,
force = false
): Promise<Result<undefined, Error>> {
const connector = await ConnectorResource.fetchById(connectorId);
if (!connector) {
Expand Down Expand Up @@ -282,9 +283,16 @@ export async function cleanupSlackConnector(
`Attempting Slack app deactivation [cleanupSlackConnector]`
);

const uninstallRes = await uninstallSlack(connector.connectionId);
if (uninstallRes.isErr()) {
return uninstallRes;
try {
const uninstallRes = await uninstallSlack(connector.connectionId);

if (uninstallRes.isErr() && !force) {
return uninstallRes;
}
} catch (e) {
if (!force) {
throw e;
}
}

logger.info(
Expand Down

0 comments on commit 81eef6f

Please sign in to comment.