diff --git a/connectors/src/connectors/slack/index.ts b/connectors/src/connectors/slack/index.ts index 300d35f3b5a2..dbbfdd9884c9 100644 --- a/connectors/src/connectors/slack/index.ts +++ b/connectors/src/connectors/slack/index.ts @@ -28,8 +28,7 @@ import { ConnectorResource } from "@connectors/resources/connector_resource"; import { SlackConfigurationResource } from "@connectors/resources/slack_configuration_resource"; import type { DataSourceConfig } from "@connectors/types/data_source_config.js"; -const { NANGO_SLACK_CONNECTOR_ID, SLACK_CLIENT_ID, SLACK_CLIENT_SECRET } = - process.env; +const { SLACK_CLIENT_ID, SLACK_CLIENT_SECRET } = process.env; export class SlackConnectorManager extends BaseConnectorManager { static async create({ @@ -88,10 +87,6 @@ export class SlackConnectorManager extends BaseConnectorManager> { - if (!NANGO_SLACK_CONNECTOR_ID) { - throw new Error("NANGO_SLACK_CONNECTOR_ID not set"); - } - const c = await ConnectorResource.fetchById(this.connectorId); if (!c) { logger.error({ connectorId: this.connectorId }, "Connector not found"); @@ -719,9 +714,6 @@ export class SlackConnectorManager extends BaseConnectorManager { - if (isDualUseOAuthConnectionId(connectionId)) { - const tokRes = await getOAuthConnectionAccessToken({ - config: apiConfig.getOAuthAPIConfig(), - logger, - provider: "slack", - connectionId, - }); - if (tokRes.isErr()) { - logger.error( - { connectionId, error: tokRes.error }, - "Error retrieving Slack access token" - ); - throw new Error("Error retrieving Slack access token"); - } - - return tokRes.value.access_token; - } else { - // TODO(spolu) SLACK_MIGRATION remove once migrated - if (!NANGO_SLACK_CONNECTOR_ID) { - throw new Error("NANGO_SLACK_CONNECTOR_ID is not defined"); - } - return getAccessTokenFromNango({ - connectionId: connectionId, - integrationId: NANGO_SLACK_CONNECTOR_ID, - useCache: true, - }); + const tokRes = await getOAuthConnectionAccessToken({ + config: apiConfig.getOAuthAPIConfig(), + logger, + provider: "slack", + connectionId, + }); + if (tokRes.isErr()) { + logger.error( + { connectionId, error: tokRes.error }, + "Error retrieving Slack access token" + ); + throw new Error("Error retrieving Slack access token"); } + + return tokRes.value.access_token; }