Gate server and admin emulator requests on credential init
Some checks failed
DB migration compat / Check if migrations changed (push) Has been cancelled
DB migration compat / Back-compat — Current branch migrations with ${{ needs.check-migrations-changed.outputs.base_branch }} branch code (push) Has been cancelled
DB migration compat / Forward-compat — Current branch code with ${{ needs.check-migrations-changed.outputs.base_branch }} branch migrations (push) Has been cancelled
DB migration compat / No migration changes (skipped) (push) Has been cancelled

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.
This commit is contained in:
Bilal Godil 2026-03-19 14:11:16 -07:00
parent 01ca85027c
commit 25f8b1ca48
2 changed files with 6 additions and 0 deletions

View File

@ -148,6 +148,9 @@ export class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, Project
secretServerKey: resolvedOptions.secretServerKey ?? getDefaultSecretServerKey({ isEmulator }),
superSecretAdminKey: resolvedOptions.superSecretAdminKey ?? getDefaultSuperSecretAdminKey({ isEmulator }),
},
prepareRequest: async () => {
if (this._emulatorInitPromise) await this._emulatorInitPromise;
},
}),
});

View File

@ -424,6 +424,9 @@ export class _StackServerAppImplIncomplete<HasTokenStore extends boolean, Projec
clientVersion,
...(publishableClientKey != null ? { publishableClientKey } : {}),
secretServerKey: resolvedOptions.secretServerKey ?? getDefaultSecretServerKey({ isEmulator }),
prepareRequest: async () => {
if (this._emulatorInitPromise) await this._emulatorInitPromise;
},
}),
});