Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decrypt provider config in refreshConnections #3485

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions packages/server/lib/refreshConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,25 @@ export async function exec(): Promise<void> {
}

const { connection, account, environment, integration } = staleConnection;
const decrypted = encryptionManager.decryptConnection(connection);
logger.info(`${cronName} refreshing connection '${connection.connection_id}' for accountId '${account.id}'`);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oups I removed this log. Will fix on Monday


const decryptedConnection = encryptionManager.decryptConnection(connection);
if (!decryptedConnection) {
logger.error(`${cronName} failed to decrypt stale connection '${connection.id}'`);
continue;
}

const decryptedIntegration = encryptionManager.decryptProviderConfig(integration);
if (!decryptedIntegration) {
logger.error(`${cronName} failed to decrypt integration '${integration.id} for stale connection '${connection.id}'`);
continue;
}

try {
const credentialResponse = await connectionService.refreshOrTestCredentials({
account,
environment,
integration,
connection: decrypted!,
integration: decryptedIntegration,
connection: decryptedConnection,
logContextGetter,
instantRefresh: false,
onRefreshSuccess: connectionRefreshSuccessHook,
Expand Down
Loading