diff --git a/src/client/gitlab.ts b/src/client/gitlab.ts index 73503a1..b1843cf 100644 --- a/src/client/gitlab.ts +++ b/src/client/gitlab.ts @@ -82,6 +82,8 @@ export const callGitlab = async ( body, }); + console.log(`Gitlab response status: ${resp.status}`); + if (resp.status === 204) { // no content, we can just return here return null; @@ -105,20 +107,20 @@ export const getGroupsData = async ( owned?: string, minAccessLevel?: number, name?: string, + pageSize = 100, ): Promise => { const params = { ...(owned ? { owned } : {}), ...(minAccessLevel ? { min_access_level: minAccessLevel.toString() } : {}), ...(name ? { search: name } : {}), + ...(pageSize ? { per_page: pageSize.toString() } : {}), }; const queryParams = queryParamsGenerator(params); - const { data } = await callGitlab( - `getGroupsData - Query params: ${queryParams}`, - `/api/v4/groups?${queryParams}`, - groupAccessToken, - ); + const { data } = await callGitlab(`getGroupsData`, `/api/v4/groups?${queryParams}`, groupAccessToken); + + console.log('Number of groups fetched:', data.length); return data; }; diff --git a/src/resolvers/shared-resolvers.ts b/src/resolvers/shared-resolvers.ts index dfa29cd..0836b15 100644 --- a/src/resolvers/shared-resolvers.ts +++ b/src/resolvers/shared-resolvers.ts @@ -43,6 +43,7 @@ export const groupsAllExisting = async (): Promise> => { + console.log('Fetching connected groups info'); try { const connectedGroups = await getConnectedGroups(); const setupConfig = await getWebhookSetupConfig(); @@ -53,6 +54,7 @@ export const connectedGroupsInfo = async (): Promise => { }; export const webhookSetupConfig = async (): Promise> => { + console.log('Fetching webhook setup config'); try { const config = await getWebhookSetupConfig(); return { @@ -83,6 +86,7 @@ export const webhookSetupConfig = async (): Promise => { const groupsResult = await Promise.allSettled(groups.map((group: Result) => storage.get(group.key))); if (hasRejections(groupsResult)) { - throw new Error(`Error getting groupIds with in-progress webhooks setup: ${getFormattedErrors(groupsResult)}`); + const errorMsg = `Error getting groupIds with in-progress webhooks setup: ${getFormattedErrors(groupsResult)}`; + console.log(errorMsg); + throw new Error(errorMsg); } const groupIds = groupsResult.map((groupResult: PromiseFulfilledResult) => groupResult.value);