Skip to content

Commit 1c597dd

Browse files
waleedlatif1claude
andcommitted
fix(connectors): address remaining audit findings
- jira: thread VALIDATE_RETRY_OPTIONS through getJiraCloudId so the validate path uses the tighter retry budget - confluence: thread VALIDATE_RETRY_OPTIONS through getConfluenceCloudId; drop residual error instanceof Error pattern - zendesk: log a warning when statusFilter is set and limit exceeds the Search API 1000-result cap; add priority to tagDefinitions and mapTags so the metadata isn't orphaned Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 6e58ee3 commit 1c597dd

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

apps/sim/connectors/confluence/confluence.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export const confluenceConnector: ConnectorConfig = {
347347
}
348348

349349
try {
350-
const cloudId = await getConfluenceCloudId(domain, accessToken)
350+
const cloudId = await getConfluenceCloudId(domain, accessToken, VALIDATE_RETRY_OPTIONS)
351351
const spaceUrl = `https://api.atlassian.com/ex/confluence/${cloudId}/wiki/api/v2/spaces?keys=${encodeURIComponent(spaceKey)}&limit=1`
352352
const response = await fetchWithRetry(
353353
spaceUrl,
@@ -369,8 +369,7 @@ export const confluenceConnector: ConnectorConfig = {
369369
}
370370
return { valid: true }
371371
} catch (error) {
372-
const message = error instanceof Error ? error.message : 'Failed to validate configuration'
373-
return { valid: false, error: message }
372+
return { valid: false, error: toError(error).message || 'Failed to validate configuration' }
374373
}
375374
},
376375

apps/sim/connectors/jira/jira.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export const jiraConnector: ConnectorConfig = {
282282
const jqlFilter = (sourceConfig.jql as string | undefined)?.trim() || ''
283283

284284
try {
285-
const cloudId = await getJiraCloudId(domain, accessToken)
285+
const cloudId = await getJiraCloudId(domain, accessToken, VALIDATE_RETRY_OPTIONS)
286286

287287
const params = new URLSearchParams()
288288
const safeKey = projectKey.replace(/\\/g, '\\\\').replace(/"/g, '\\"')

apps/sim/connectors/zendesk/zendesk.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const logger = createLogger('ZendeskConnector')
1010
const ARTICLES_PER_PAGE = 30
1111
const TICKETS_PER_PAGE = 100
1212
const DEFAULT_MAX_TICKETS = 500
13+
const SEARCH_API_RESULT_CAP = 1000
1314

1415
const VALID_TICKET_STATUSES = new Set(['new', 'open', 'pending', 'hold', 'solved', 'closed'])
1516

@@ -134,6 +135,11 @@ async function fetchTickets(
134135
let url: string | null = `${baseUrl}/api/v2/tickets.json?per_page=${TICKETS_PER_PAGE}`
135136

136137
if (statusFilter && statusFilter !== 'all' && VALID_TICKET_STATUSES.has(statusFilter)) {
138+
if (limit > SEARCH_API_RESULT_CAP) {
139+
logger.warn(
140+
`Zendesk Search API caps at ${SEARCH_API_RESULT_CAP} results; requested limit ${limit} will be truncated. Remove status filter to use the unbounded tickets endpoint.`
141+
)
142+
}
137143
const params = new URLSearchParams({
138144
query: `type:ticket status:${statusFilter}`,
139145
per_page: String(TICKETS_PER_PAGE),
@@ -509,6 +515,7 @@ export const zendeskConnector: ConnectorConfig = {
509515
tagDefinitions: [
510516
{ id: 'contentType', displayName: 'Content Type', fieldType: 'text' },
511517
{ id: 'status', displayName: 'Status', fieldType: 'text' },
518+
{ id: 'priority', displayName: 'Priority', fieldType: 'text' },
512519
{ id: 'labels', displayName: 'Labels', fieldType: 'text' },
513520
{ id: 'tags', displayName: 'Tags', fieldType: 'text' },
514521
{ id: 'updatedAt', displayName: 'Last Updated', fieldType: 'date' },
@@ -526,6 +533,10 @@ export const zendeskConnector: ConnectorConfig = {
526533
result.status = metadata.status
527534
}
528535

536+
if (typeof metadata.priority === 'string') {
537+
result.priority = metadata.priority
538+
}
539+
529540
const labels = joinTagArray(metadata.labels)
530541
if (labels) {
531542
result.labels = labels

apps/sim/tools/jira/utils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createLogger } from '@sim/logger'
2+
import type { RetryOptions } from '@/lib/knowledge/documents/utils'
23
import { fetchWithRetry } from '@/lib/knowledge/documents/utils'
34

45
const logger = createLogger('JiraUtils')
@@ -163,7 +164,11 @@ export function normalizeDomain(domain: string): string {
163164
.replace(/\/+$/, '')}`.toLowerCase()
164165
}
165166

166-
export async function getJiraCloudId(domain: string, accessToken: string): Promise<string> {
167+
export async function getJiraCloudId(
168+
domain: string,
169+
accessToken: string,
170+
retryOptions?: RetryOptions
171+
): Promise<string> {
167172
const response = await fetchWithRetry(
168173
'https://api.atlassian.com/oauth/token/accessible-resources',
169174
{
@@ -172,7 +177,8 @@ export async function getJiraCloudId(domain: string, accessToken: string): Promi
172177
Authorization: `Bearer ${accessToken}`,
173178
Accept: 'application/json',
174179
},
175-
}
180+
},
181+
retryOptions
176182
)
177183

178184
if (!response.ok) {

0 commit comments

Comments
 (0)