From d21bdb0ea8033c18610285ced474b5746ed051c5 Mon Sep 17 00:00:00 2001 From: Konstantin Wohlwend Date: Tue, 14 Apr 2026 20:35:20 -0700 Subject: [PATCH] Skip diagnostics for analytics requests --- .../src/interface/client-interface.ts | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/stack-shared/src/interface/client-interface.ts b/packages/stack-shared/src/interface/client-interface.ts index 727965158..6942da804 100644 --- a/packages/stack-shared/src/interface/client-interface.ts +++ b/packages/stack-shared/src/interface/client-interface.ts @@ -465,6 +465,7 @@ export class StackClientInterface { session: InternalSession | null, requestType: "client" | "server" | "admin" = "client", apiUrlOverride?: string, + retryOptions?: { maxAttempts?: number, skipDiagnostics?: boolean }, ) { session ??= this.createSession({ refreshToken: null, @@ -472,19 +473,20 @@ export class StackClientInterface { if (apiUrlOverride) { return await this._networkRetry( - () => this.sendClientRequestInner(path, requestOptions, session!, requestType, apiUrlOverride), - session, - requestType, - ); - } - - return await this._withFallback(async (apiUrl, retryOptions) => { - return await this._networkRetry( - () => this.sendClientRequestInner(path, requestOptions, session!, requestType, apiUrl), + () => this.sendClientRequestInner(path, requestOptions, session!, requestType, apiUrlOverride, retryOptions), session, requestType, retryOptions, ); + } + + return await this._withFallback(async (apiUrl, fallbackRetryOptions) => { + return await this._networkRetry( + () => this.sendClientRequestInner(path, requestOptions, session!, requestType, apiUrl, retryOptions), + session, + requestType, + { ...fallbackRetryOptions, ...retryOptions }, + ); }); } @@ -513,6 +515,7 @@ export class StackClientInterface { session, "client", this.getAnalyticsApiUrl(), + { maxAttempts: 1, skipDiagnostics: true }, ); return Result.ok(response); } catch (e) { @@ -537,6 +540,7 @@ export class StackClientInterface { session, "client", this.getAnalyticsApiUrl(), + { maxAttempts: 1, skipDiagnostics: true }, ); return Result.ok(response); } catch (e) { @@ -576,6 +580,7 @@ export class StackClientInterface { session: InternalSession, requestType: "client" | "server" | "admin", apiUrlOverride?: string, + innerOptions?: { skipDiagnostics?: boolean }, ): Promise