From 59d1a4c57d09f1d80a148a01fb58da0b984a0fcd Mon Sep 17 00:00:00 2001 From: msukkari Date: Tue, 23 Dec 2025 10:49:44 -0500 Subject: [PATCH 1/3] better logs for gitlab config sync --- packages/backend/src/gitlab.ts | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/packages/backend/src/gitlab.ts b/packages/backend/src/gitlab.ts index b461d59b..d3e10dbd 100644 --- a/packages/backend/src/gitlab.ts +++ b/packages/backend/src/gitlab.ts @@ -97,13 +97,10 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) = logger.error(`Failed to fetch projects for group ${group}.`, e); const status = e?.cause?.response?.status; - if (status === 404) { - const warning = `Group ${group} not found or no access`; - logger.warn(warning); - return { - type: 'warning' as const, - warning - }; + if (status !== undefined) { + logger.error(`HTTP status: ${status}`); + } else { + logger.error(`HTTP status: undefined`); } throw e; } @@ -135,13 +132,10 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) = logger.error(`Failed to fetch projects for user ${user}.`, e); const status = e?.cause?.response?.status; - if (status === 404) { - const warning = `User ${user} not found or no access`; - logger.warn(warning); - return { - type: 'warning' as const, - warning - }; + if (status !== undefined) { + logger.error(`HTTP status: ${status}`); + } else { + logger.error(`HTTP status: undefined`); } throw e; } @@ -171,14 +165,10 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) = logger.error(`Failed to fetch project ${project}.`, e); const status = e?.cause?.response?.status; - - if (status === 404) { - const warning = `Project ${project} not found or no access`; - logger.warn(warning); - return { - type: 'warning' as const, - warning - }; + if (status !== undefined) { + logger.error(`HTTP status: ${status}`); + } else { + logger.error(`HTTP status: undefined`); } throw e; } From 51424b3cdb79b7196ef97fc4003bc032ff7ecc85 Mon Sep 17 00:00:00 2001 From: msukkari Date: Tue, 23 Dec 2025 10:58:43 -0500 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0897c85a..c9146227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Bake Sourcebot version into code rather than relying on build arg. [#680](https://github.com/sourcebot-dev/sourcebot/pull/680) - Fix issue with `/repos` page pagination. [#689](https://github.com/sourcebot-dev/sourcebot/pull/689) +- Add better logs for gitlab config sync fails. [#692](https://github.com/sourcebot-dev/sourcebot/pull/692) ## [4.10.4] - 2025-12-18 From f81bd3b7bd461b483043c191bbb992624724f1c6 Mon Sep 17 00:00:00 2001 From: msukkari Date: Tue, 23 Dec 2025 11:03:22 -0500 Subject: [PATCH 3/3] return warning object correctly --- packages/backend/src/gitlab.ts | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/gitlab.ts b/packages/backend/src/gitlab.ts index d3e10dbd..44685424 100644 --- a/packages/backend/src/gitlab.ts +++ b/packages/backend/src/gitlab.ts @@ -98,10 +98,15 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) = const status = e?.cause?.response?.status; if (status !== undefined) { - logger.error(`HTTP status: ${status}`); - } else { - logger.error(`HTTP status: undefined`); + const warning = `GitLab API returned ${status}` + logger.warning(warning); + return { + type: 'warning' as const, + warning + } } + + logger.error("No API response status returned"); throw e; } })); @@ -133,10 +138,15 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) = const status = e?.cause?.response?.status; if (status !== undefined) { - logger.error(`HTTP status: ${status}`); - } else { - logger.error(`HTTP status: undefined`); + const warning = `GitLab API returned ${status}` + logger.warning(warning); + return { + type: 'warning' as const, + warning + } } + + logger.error("No API response status returned"); throw e; } })); @@ -166,10 +176,15 @@ export const getGitLabReposFromConfig = async (config: GitlabConnectionConfig) = const status = e?.cause?.response?.status; if (status !== undefined) { - logger.error(`HTTP status: ${status}`); - } else { - logger.error(`HTTP status: undefined`); + const warning = `GitLab API returned ${status}` + logger.warning(warning); + return { + type: 'warning' as const, + warning + } } + + logger.error("No API response status returned"); throw e; } }));