diff --git a/packages/kvs-client/src/client.ts b/packages/kvs-client/src/client.ts index 07f8a352f1..618e100a02 100644 --- a/packages/kvs-client/src/client.ts +++ b/packages/kvs-client/src/client.ts @@ -187,6 +187,7 @@ class KeyValueClientImpl implements KeyValueClient { errMessage.includes('network') if (!isNetworkError || timeout < Date.now()) { + console.error(`KVS request failed for url ${url}`, err.message) throw err } diff --git a/services/gmail/pod-gmail/src/gmailController.ts b/services/gmail/pod-gmail/src/gmailController.ts index e6716b02c8..40a03e8926 100644 --- a/services/gmail/pod-gmail/src/gmailController.ts +++ b/services/gmail/pod-gmail/src/gmailController.ts @@ -93,35 +93,39 @@ export class GmailController { this.ctx.info('Workspaces with integrations', { count: workspaceIds.size }) for (const workspace of workspaceIds) { - const wsToken = serviceToken(workspace) - const accountClient = getAccountClient(wsToken) + try { + const wsToken = serviceToken(workspace) + const accountClient = getAccountClient(wsToken) - const tokens = await getWorkspaceTokens(accountClient, workspace) - await limiter.add(async () => { - const info = await accountClient.getWorkspaceInfo() + const tokens = await getWorkspaceTokens(accountClient, workspace) + await limiter.add(async () => { + const info = await accountClient.getWorkspaceInfo() - if (info === undefined) { - this.ctx.info('workspace not found', { workspaceUuid: workspace }) - return - } - if (!isActiveMode(info.mode)) { - this.ctx.info('workspace is not active', { workspaceUuid: workspace }) - return - } - this.ctx.info('Use stored tokens', { count: tokens.length }) - const startPromise = this.startWorkspace(workspace, tokens) - const timeoutPromise = new Promise((resolve) => { - setTimeout(() => { - resolve() - }, 60000) + if (info === undefined) { + this.ctx.info('workspace not found', { workspaceUuid: workspace }) + return + } + if (!isActiveMode(info.mode)) { + this.ctx.info('workspace is not active', { workspaceUuid: workspace }) + return + } + this.ctx.info('Use stored tokens', { count: tokens.length }) + const startPromise = this.startWorkspace(workspace, tokens) + const timeoutPromise = new Promise((resolve) => { + setTimeout(() => { + resolve() + }, 60000) + }) + await Promise.race([startPromise, timeoutPromise]) }) - await Promise.race([startPromise, timeoutPromise]) - }) + } catch (err: any) { + this.ctx.error('Failed to create workspace client', { workspaceUuid: workspace, error: err.message }) + } } await limiter.waitProcessing() } catch (err: any) { - this.ctx.error('Failed to start existing integrations', err) + this.ctx.error('Failed to start existing integrations', { error: err.message }) } }