From 25f8b1ca48cb65c3de9786f8e72cdfc6c43df7c2 Mon Sep 17 00:00:00 2001 From: Bilal Godil Date: Thu, 19 Mar 2026 14:11:16 -0700 Subject: [PATCH] Gate server and admin emulator requests on credential init Add prepareRequest callbacks to StackServerInterface and StackAdminInterface that await _emulatorInitPromise, matching the existing pattern in the client app. Prevents race conditions where requests use placeholder credentials before the emulator credentials are fetched. --- .../src/lib/stack-app/apps/implementations/admin-app-impl.ts | 3 +++ .../src/lib/stack-app/apps/implementations/server-app-impl.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts b/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts index e85bad857..89b791a7a 100644 --- a/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts +++ b/packages/template/src/lib/stack-app/apps/implementations/admin-app-impl.ts @@ -148,6 +148,9 @@ export class _StackAdminAppImplIncomplete { + if (this._emulatorInitPromise) await this._emulatorInitPromise; + }, }), }); diff --git a/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts b/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts index 1850c563b..f78e519da 100644 --- a/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts +++ b/packages/template/src/lib/stack-app/apps/implementations/server-app-impl.ts @@ -424,6 +424,9 @@ export class _StackServerAppImplIncomplete { + if (this._emulatorInitPromise) await this._emulatorInitPromise; + }, }), });