diff --git a/src/lib/firebase/client/client.ts b/src/lib/firebase/client/client.ts index 2a5f804..146aed2 100644 --- a/src/lib/firebase/client/client.ts +++ b/src/lib/firebase/client/client.ts @@ -163,13 +163,7 @@ export class Client extends TypedEmitter { if (!this.admin) await signOut(this._auth!); } - if (this.admin) { - await this.deleteClient(); - } else { - // https://github.com/firebase/firebase-js-sdk/issues/7816 - // TODO: The promise is not resolved due to a bug in Node. Workaround for now to not wait for it anymore. - this.deleteClient(); - } + return this.deleteClient(); } private async wrapSignIn(config: AppOptions): Promise; diff --git a/src/lib/nodes/firebase-client.ts b/src/lib/nodes/firebase-client.ts index 807fece..8a07161 100644 --- a/src/lib/nodes/firebase-client.ts +++ b/src/lib/nodes/firebase-client.ts @@ -343,7 +343,6 @@ export class FirebaseClient { try { if (!this.node.client) return done(); - // TODO: Add firestore const rtdbOnline = this.node.rtdb && !this.node.rtdb.offline; const firestoreOnline = this.node.firestore && !this.node.firestore.offline; @@ -356,7 +355,17 @@ export class FirebaseClient { this.disableConnectionHandler(); this.disableGlobalLogHandler(); - await this.node.client.signOut(); + if (!this.node.client.admin && this.node.firestore) { + // https://github.com/firebase/firebase-js-sdk/issues/7816 + // TODO: The promise is not resolved due to a bug in Node. + // Workaround for now to not wait for it anymore. + this.node.client.signOut(); + + // Small delay to ensure deployments won't cause any issues. + await new Promise((resolve) => setTimeout(resolve, 1500)); + } else { + await this.node.client.signOut(); + } done(); } catch (error) {