Skip to content

Commit 137c961

Browse files
xinredhatBohdanMar
authored andcommitted
fix GitLab API timeout error when setting environment variables
Assisted-by: Claude Code
1 parent 6a5daf9 commit 137c961

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/api/gitlab/config/gitlab.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface GitLabConfig {
1111

1212
/**
1313
* Request timeout in milliseconds
14-
* @default 30000
14+
* @default 60000
1515
*/
1616
readonly timeout?: number;
1717

@@ -93,7 +93,7 @@ export class GitLabConfigBuilder {
9393
throw new Error('GitLab token is required');
9494
}
9595

96-
const timeout = this.config.timeout ?? 30000;
96+
const timeout = this.config.timeout ?? 60000;
9797
if (timeout <= 0) {
9898
throw new Error('Timeout must be greater than 0');
9999
}

src/api/gitlab/gitlab.client.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { BaseApiClient } from '../common/base-api.client';
2121
* const client = new GitLabClient({
2222
* token: 'glpat_your_token_here',
2323
* baseUrl: 'https://gitlab.example.com', // Your GitLab instance URL
24-
* timeout: 30000 // Optional, defaults to 30 seconds
24+
* timeout: 60000 // Optional, defaults to 60 seconds
2525
* });
2626
*
2727
* // Check connectivity
@@ -98,7 +98,7 @@ export class GitLabClient extends BaseApiClient {
9898
* @param config Configuration options for the GitLab client
9999
* @param config.token GitLab personal access token (required)
100100
* @param config.baseUrl GitLab instance base URL (required)
101-
* @param config.timeout Request timeout in milliseconds (optional, defaults to 30000)
101+
* @param config.timeout Request timeout in milliseconds (optional, defaults to 60000)
102102
*
103103
* @example
104104
* ```typescript
@@ -110,10 +110,12 @@ export class GitLabClient extends BaseApiClient {
110110
* ```
111111
*/
112112
constructor(config: GitLabConfig) {
113-
super(config.baseUrl || 'https://gitlab.com', config.timeout || 30000);
113+
super(config.baseUrl || 'https://gitlab.com', config.timeout || 60000);
114114
this.client = new Gitlab({
115115
host: this.baseUrl,
116116
token: config.token,
117+
queryTimeout: this.timeout,
118+
rejectUnauthorized: config.sslVerify,
117119
});
118120

119121
this.projects = new GitLabProjectService(this.client);

0 commit comments

Comments
 (0)