Skip to content

Commit f4fd34d

Browse files
committed
Revert branch-local KB connector error-message edits
Restores apps/sim/connectors/ to staging state. Two copilot-focused commits on this branch (3a9fc1c, 24b24e5) drove by nine KB source connectors (airtable, confluence, discord, github, gitlab, google-drive, microsoft-teams, notion, slack) to enrich credential-validation error messages. The env-reference resolution machinery those errors supported is kept; the product connector surface stays unchanged in this branch so the staging promotion remains scoped to copilot work.
1 parent f793bde commit f4fd34d

9 files changed

Lines changed: 16 additions & 62 deletions

File tree

apps/sim/connectors/airtable/airtable.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,7 @@ export const airtableConnector: ConnectorConfig = {
333333
if (response.status === 403) {
334334
return { valid: false, error: 'Access denied. Check your Airtable permissions.' }
335335
}
336-
return {
337-
valid: false,
338-
error: `Airtable API error: ${response.status} — 401 means an invalid PAT (or an unresolved {{ENV_VAR}} placeholder); 403 means the PAT has no access to base "${baseId}". Detail: ${errorText}`,
339-
}
336+
return { valid: false, error: `Airtable API error: ${response.status} - ${errorText}` }
340337
}
341338

342339
const viewId = readConfigString(sourceConfig, 'viewId')
@@ -353,10 +350,7 @@ export const airtableConnector: ConnectorConfig = {
353350
VALIDATE_RETRY_OPTIONS
354351
)
355352
if (!viewResponse.ok) {
356-
return {
357-
valid: false,
358-
error: `View "${viewId}" not found in table "${tableIdOrName}" — or the PAT lacks access to it.`,
359-
}
353+
return { valid: false, error: `View "${viewId}" not found in table "${tableIdOrName}"` }
360354
}
361355
}
362356

apps/sim/connectors/confluence/confluence.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,7 @@ export const confluenceConnector: ConnectorConfig = {
455455
VALIDATE_RETRY_OPTIONS
456456
)
457457
if (!response.ok) {
458-
return {
459-
valid: false,
460-
error: `Failed to list Confluence spaces: ${response.status} — 401/403 means the credential lacks space-read scope on this site; 404 means the domain is wrong.`,
461-
}
458+
return { valid: false, error: `Failed to validate spaces: ${response.status}` }
462459
}
463460
const data = await response.json()
464461
const results = (data.results as Array<Record<string, unknown>> | undefined) ?? []
@@ -467,7 +464,7 @@ export const confluenceConnector: ConnectorConfig = {
467464
if (missing.length > 0) {
468465
return {
469466
valid: false,
470-
error: `Space${missing.length > 1 ? 's' : ''} not found: ${missing.join(', ')} — the credential may not see them; they may be in another Atlassian site or restricted spaces the connected user is not a member of.`,
467+
error: `Space${missing.length > 1 ? 's' : ''} not found: ${missing.join(', ')}`,
471468
}
472469
}
473470
return { valid: true }

apps/sim/connectors/discord/discord.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,11 @@ export const discordConnector: ConnectorConfig = {
371371
if (message.includes('401') || message.includes('403')) {
372372
return {
373373
valid: false,
374-
error:
375-
'Discord rejected the request (401/403) — the bot token is invalid, or the bot lacks access to this channel (invite the bot to the server/channel and grant Read Message History).',
374+
error: 'Invalid bot token, or the bot lacks View Channel access to this channel',
376375
}
377376
}
378377
if (message.includes('404')) {
379-
return {
380-
valid: false,
381-
error: `Channel not found: ${channelId}. The bot cannot see it — invite the bot to that server/channel, or check the channel id.`,
382-
}
378+
return { valid: false, error: `Channel not found: ${channelId}` }
383379
}
384380
return { valid: false, error: message }
385381
}

apps/sim/connectors/github/github.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,7 @@ export const githubConnector: ConnectorConfig = {
483483
}
484484

485485
if (!response.ok) {
486-
return {
487-
valid: false,
488-
error:
489-
response.status === 401
490-
? 'Cannot access repository: 401 — the token was rejected (invalid, expired, or not a real token). Pass a valid PAT or a {{ENV_VAR}} reference to one.'
491-
: response.status === 403
492-
? 'Cannot access repository: 403 — the token lacks access to this repository (missing repo scope, or fine-grained token not granted to it).'
493-
: `Cannot access repository: ${response.status}`,
494-
}
486+
return { valid: false, error: `Cannot access repository: ${response.status}` }
495487
}
496488

497489
return { valid: true }

apps/sim/connectors/gitlab/gitlab.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,18 +1083,8 @@ export const gitlabConnector: ConnectorConfig = {
10831083
if (response.status === 404) {
10841084
return { valid: false, error: `Project "${project}" not found on ${host}` }
10851085
}
1086-
if (response.status === 401) {
1087-
return {
1088-
valid: false,
1089-
error:
1090-
'GitLab rejected the token (401) — it is invalid, expired, or an unresolved {{ENV_VAR}} placeholder. Pass a valid token or a {{ENV_VAR}} reference to one.',
1091-
}
1092-
}
1093-
if (response.status === 403) {
1094-
return {
1095-
valid: false,
1096-
error: `GitLab token lacks access (403) — it needs read_api/read_repository on "${project}".`,
1097-
}
1086+
if (response.status === 401 || response.status === 403) {
1087+
return { valid: false, error: 'Invalid token or insufficient permissions' }
10981088
}
10991089
if (!response.ok) {
11001090
return { valid: false, error: `Cannot access project: ${response.status}` }

apps/sim/connectors/google-drive/google-drive.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ export const googleDriveConnector: ConnectorConfig = {
391391
}
392392
return {
393393
valid: false,
394-
error: `Failed to access folder "${folderId}": ${response.status} — 403 means the folder exists but is not shared with the connected Google account.`,
394+
error: `Failed to access folder "${folderId}": ${response.status}`,
395395
}
396396
}
397397

@@ -417,10 +417,7 @@ export const googleDriveConnector: ConnectorConfig = {
417417
)
418418

419419
if (!response.ok) {
420-
return {
421-
valid: false,
422-
error: `Failed to access Google Drive: ${response.status} — 401 means the token expired (reconnect the Google credential); 403 usually means a missing Drive scope.`,
423-
}
420+
return { valid: false, error: `Failed to access Google Drive: ${response.status}` }
424421
}
425422
}
426423

apps/sim/connectors/microsoft-teams/microsoft-teams.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,7 @@ export const microsoftTeamsConnector: ConnectorConfig = {
474474
VALIDATE_RETRY_OPTIONS
475475
)
476476
if (!channel) {
477-
return {
478-
valid: false,
479-
error: `Channel not found: ${channelInput}. The connected account cannot see it — it may be in a different team/tenant, or a private channel the user is not a member of.`,
480-
}
477+
return { valid: false, error: `Channel not found: ${channelInput}` }
481478
}
482479

483480
// Verify we can read messages by fetching a single message

apps/sim/connectors/notion/notion.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ export const notionConnector: ConnectorConfig = {
465465
if (!response.ok) {
466466
return {
467467
valid: false,
468-
error: `Cannot access database ${databaseId}: ${response.status} — 401 means a rejected token; 404 usually means the database is not shared with this Notion integration (share it from the page's "Connections" menu).`,
468+
error: `Cannot access database ${databaseId}: ${response.status}`,
469469
}
470470
}
471471
}
@@ -483,10 +483,7 @@ export const notionConnector: ConnectorConfig = {
483483
VALIDATE_RETRY_OPTIONS
484484
)
485485
if (!response.ok) {
486-
return {
487-
valid: false,
488-
error: `Cannot access page ${rootPageId}: ${response.status} — the page is likely not shared with this Notion integration; add it under the page's "Connections" menu.`,
489-
}
486+
return { valid: false, error: `Cannot access page: ${response.status}` }
490487
}
491488
} else {
492489
// Workspace scope — just verify token works

apps/sim/connectors/slack/slack.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,7 @@ export const slackConnector: ConnectorConfig = {
717717
* instead of reconnecting the credential.
718718
*/
719719
if (error instanceof SlackApiError && error.code === 'channel_not_found') {
720-
return {
721-
valid: false,
722-
error: `Channel not found: ${input}. The selected credential cannot see it — it may belong to a different Slack workspace, or the channel is private and the connected user/bot is not a member.`,
723-
}
720+
return { valid: false, error: `Channel not found: ${input}` }
724721
}
725722
throw error
726723
}
@@ -766,10 +763,7 @@ export const slackConnector: ConnectorConfig = {
766763
} while (cursor)
767764

768765
const missing = Array.from(remaining)
769-
return {
770-
valid: false,
771-
error: `Channel(s) not found: ${missing.join(', ')}. The selected credential cannot see them — they may belong to a different Slack workspace, or they are private channels the connected user/bot is not a member of.`,
772-
}
766+
return { valid: false, error: `Channel(s) not found: ${missing.join(', ')}` }
773767
} catch (error) {
774768
const message = toError(error).message || 'Failed to validate configuration'
775769
return { valid: false, error: message }

0 commit comments

Comments
 (0)