Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleteApp hangs indefinitely when auth and firestore are initialized #7816

Open
kaisermann opened this issue Nov 27, 2023 · 3 comments
Open

Comments

@kaisermann
Copy link

kaisermann commented Nov 27, 2023

Operating System

MacOS Sonoma 14.1.1

Browser Version

n/a

Firebase SDK Version

10.6.0

Firebase SDK Product:

Firestore

Describe your project's tooling

The minimal repro contains only the js SDK in the latest version. Tested in node@16 @18 and @20.

Describe the problem

Calling deleteApp for an app initialized with both firestore/auth hangs indefinitely. I encountered this while trying to connect both to the emulator, but the issue seems to happen without calling the connect{...}Emulator functions.

However, if some operation is called to the firestore instance, the app seems to be deleted as expected.

Steps and code to reproduce issue

Stackblitz repro

Create a repro.mjs file with:

import { deleteApp, initializeApp } from 'firebase/app';
import { initializeAuth } from 'firebase/auth';
import { initializeFirestore, doc, getDoc } from 'firebase/firestore';

const testApp = initializeApp({
  apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  projectId: 'some-project-id',
});

// Comment these two lines and the app will delete successfully
const testFirestore = initializeFirestore(testApp, {
  ignoreUndefinedProperties: true,
});

// Or comment these two lines and the app will delete successfully
const testAuth = initializeAuth(testApp);

async function reproIssue() {
  console.log('Deleting app...');

  // Uncomment this getDoc call and the deleteApp works with both firestore/auth
  // await getDoc(doc(testFirestore, 'users/alice'), { name: 'Alice' }).catch(
  //   () => {
  //     /** ignore errors */
  //   }
  // );

  // This hangs indefinitely when both firestore and auth are initialized
  // This DOES NOT hand if only firestore or auth is initialized
  // Or if the getDoc call above is not commented.
  await deleteApp(testApp);
  console.log('App deleted'); // This is never reached
}

await reproIssue();
  1. Run node repro.mjs

  2. Deleting app... should be logged but App deleted not.
    CleanShot 2023-11-27 at 10 55 53

  3. Comment either the testFirestore or testAuth initialization and run the file again..

  4. Both Deleting app... and App deleted should be logged.
    CleanShot 2023-11-27 at 10 56 04

  5. Now add an operation to firestore, i.e a getDoc, right before the deleteApp:

  await getDoc(doc(testFirestore, 'users/alice'), { name: 'Alice' }).catch(
    () => {}
  );
  1. Run the file again with both auth/firestore initialized.

  2. Both Deleting app... and App deleted should be logged.

CleanShot 2023-11-27 at 11 26 15

@kaisermann kaisermann added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Nov 27, 2023
@jbalidiong jbalidiong added needs-attention and removed new A new issue that hasn't be categoirzed as question, bug or feature request labels Nov 27, 2023
@kaisermann kaisermann changed the title deleteApp hangs indefinitely when auth and present are initialized deleteApp hangs indefinitely when auth and firestore are initialized Nov 27, 2023
@milaGGL milaGGL self-assigned this Nov 27, 2023
@milaGGL
Copy link
Contributor

milaGGL commented Nov 27, 2023

Hi @kaisermann, thank you for reporting this issue. I am able to reproduce the error with the provided code. I will start looking into the issue.

@tappin-kr
Copy link

Hi @kaisermann, thank you for reporting this issue. I am able to reproduce the error with the provided code. I will start looking into the issue.

Any update on this issue? I see the PR was closed, not merged.

@milaGGL
Copy link
Contributor

milaGGL commented May 1, 2024

Hi @tappin-kr, that PR only solves the problem by ignoring a promises that we should have waited for, and high likely will introduce other errors. The main problem actually exists in a node library, which explains why this only happens in Node.

Internally pinged another team to debug the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants