Skip to content

Commit d395225

Browse files
fix:fix HPE_INVALID_HEADER_TOKEN error on creating new GitHub project
1 parent e6e6a34 commit d395225

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

src/base-command.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,27 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
198198
* @memberof BaseCommand
199199
*/
200200
async prepareApiClients(): Promise<void> {
201+
let headers = {
202+
'X-CS-CLI': this.context.analyticsInfo
203+
} as any;
204+
205+
const { uid, organizationUid } = this.sharedConfig.currentConfig;
206+
207+
if (uid) {
208+
headers['x-project-uid'] = uid;
209+
}
210+
211+
if (organizationUid) {
212+
headers['organization_uid'] = organizationUid;
213+
}
214+
201215
this.apolloClient = await new GraphqlApiClient({
202-
headers: {
203-
'X-CS-CLI': this.context.analyticsInfo,
204-
'x-project-uid': this.sharedConfig.currentConfig.uid,
205-
organization_uid: this.sharedConfig.currentConfig.organizationUid,
206-
},
216+
headers,
207217
baseUrl: this.sharedConfig.manageApiBaseUrl,
208218
}).apolloClient;
219+
209220
this.apolloLogsClient = await new GraphqlApiClient({
210-
headers: {
211-
'X-CS-CLI': this.context.analyticsInfo,
212-
'x-project-uid': this.sharedConfig.currentConfig.uid,
213-
organization_uid: this.sharedConfig.currentConfig.organizationUid,
214-
},
221+
headers,
215222
baseUrl: this.sharedConfig.logsApiBaseUrl,
216223
}).apolloClient;
217224
}

0 commit comments

Comments
 (0)