Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
fix: middleware connection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
msrivastav13 committed Dec 24, 2021
1 parent cab238d commit b172db5
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ const jwtAuthWithSalesforce = async ({ payload, context, next }) => {
// Cache connection object for 10 minutes in the app
if (connectionCache.has(slackUserId)) {
sfConnection = connectionCache.get(slackUserId);
context.hasAuthorized = true;
} else {
try {
sfConnection = await sf.connect();
context.sfconnection = sfConnection;
context.hasAuthorized = true;
connectionCache.set(slackUserId, sfConnection);
} catch (e) {
console.log(e);
throw new Error(e.message);
}
}
context.sfconnection = sfConnection;
context.hasAuthorized = true;
await next();
};

Expand Down

0 comments on commit b172db5

Please sign in to comment.