Skip to content

Commit

Permalink
Update control-plane/src/modules/integrations/slack/index.ts
Browse files Browse the repository at this point in the history
Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
  • Loading branch information
johnjcsmith and qodo-merge-pro[bot] authored Dec 29, 2024
1 parent a9908e1 commit edb474d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions control-plane/src/modules/integrations/slack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,15 @@ const authenticateUser = async (event: KnownEventFromType<"message">, client: we
logger.info("Missing CLERK_SECRET_KEY. Skipping Slack user authentication.");
return
}

if (!hasUser(event)) {
logger.warn("Slack event has no user.");
throw new AuthenticationError("Slack event has no user");
try {
const slackUser = await client.users.info({
user: event.user,
token: client.token,
});
} catch (error) {
logger.error("Failed to fetch Slack user info", { error });
throw new AuthenticationError("Could not authenticate Slack user");
}
}

const slackUser = await client.users.info({
Expand Down

0 comments on commit edb474d

Please sign in to comment.