Skip to content

Commit

Permalink
Only don't wait signout for Firestore and add a safety delay (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
GogoVega authored Oct 26, 2024
1 parent c4a622f commit bc6f38f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/lib/firebase/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,7 @@ export class Client extends TypedEmitter<ClientEvents> {
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<void>;
Expand Down
13 changes: 11 additions & 2 deletions src/lib/nodes/firebase-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down

0 comments on commit bc6f38f

Please sign in to comment.