diff --git a/packages/core-app-api/src/lib/AuthSessionManager/RefreshingAuthSessionManager.ts b/packages/core-app-api/src/lib/AuthSessionManager/RefreshingAuthSessionManager.ts index 72c4687fd6..216409a528 100644 --- a/packages/core-app-api/src/lib/AuthSessionManager/RefreshingAuthSessionManager.ts +++ b/packages/core-app-api/src/lib/AuthSessionManager/RefreshingAuthSessionManager.ts @@ -64,21 +64,6 @@ export class RefreshingAuthSessionManager implements SessionManager { } async getSession(options: GetSessionOptions): Promise { - // eslint-disable-next-line consistent-this - const that = this; - const createSession = async () => { - // We can call authRequester multiple times, the returned session will contain all requested scopes. - that.currentSession = await that.connector.createSession({ - ...options, - scopes: that.helper.getExtendedScope( - that.currentSession, - options.scopes, - ), - }); - that.stateTracker.setIsSignedIn(true); - return that.currentSession; - }; - if ( this.helper.sessionExistsAndHasScope(this.currentSession, options.scopes) ) { @@ -98,17 +83,10 @@ export class RefreshingAuthSessionManager implements SessionManager { } return refreshedSession; } catch (error) { - try { - return createSession(); - } catch (err) { - if (options.optional) { - return undefined; - } - throw new Error( - `Cannot create a new session after failing to refresh the session. Session refresh error: ${error}`, - { cause: err }, - ); + if (options.optional) { + return undefined; } + throw error; } } @@ -135,7 +113,13 @@ export class RefreshingAuthSessionManager implements SessionManager { return undefined; } - return createSession(); + // We can call authRequester multiple times, the returned session will contain all requested scopes. + this.currentSession = await this.connector.createSession({ + ...options, + scopes: this.helper.getExtendedScope(this.currentSession, options.scopes), + }); + this.stateTracker.setIsSignedIn(true); + return this.currentSession; } async removeSession() { diff --git a/plugins/techdocs-node/src/stages/publish/googleStorage.ts b/plugins/techdocs-node/src/stages/publish/googleStorage.ts index 3eac9834d2..e0da6ab528 100644 --- a/plugins/techdocs-node/src/stages/publish/googleStorage.ts +++ b/plugins/techdocs-node/src/stages/publish/googleStorage.ts @@ -348,6 +348,7 @@ export class GoogleGCSPublish implements PublisherBase { * can be used to verify if there are any pre-generated docs available to serve. */ async hasDocsBeenGenerated(entity: Entity): Promise { + Promise.resolve(); return new Promise(resolve => { const entityTriplet = `${entity.metadata.namespace}/${entity.kind}/${entity.metadata.name}`; const entityDir = this.legacyPathCasing