firebase / firebase/firebase-admin-node

deleteApp apparently doesn't complete teardown of Firestore connections

Abierto
#2,825 1 comentario 0 reacciones 1 asignado Reclamado por @lahirumaramba Ver en GitHub
api: core api: firestore
Lenguaje dominante
TypeScript
Estrellas
1.7k
Forks
419
Merge medio
3 d 10 h
PR fusionados (30 d)
16

Descripción

### Describe your environment

* Operating System version: Fedora Linx 38
* Firebase SDK version: 13.0.2
* Firebase Product: admin SDK apparently / Firestore
* Node.js version: 22.12.0
* NPM version: 11.0.0
* Deno version 2.1.4

### Describe the problem

I'm running a simple Deno test of writing to a document in a Firestore collection. The test passes, but Deno detects leaks:

```
error: Leaks detected:
- "http2Client" was created during the test, but not cleaned up during the test. Close the resource before the end of the test.
- "http2ClientConnection" was created during the test, but not cleaned up during the test. Close the resource before the end of the test.
- 2 intervals were started in this test, but never completed. This is often caused by not calling `clearInterval`.
- 2 timers were started in this test, but never completed. This is often caused by not calling `clearTimeout`.
- An async call to op_http2_poll_client_connection was started in this test, but never completed.
```

#### Steps to reproduce:

```sh
deno test --allow-all leaks-bug.ts
```

#### leaks-bug.ts
```ts
import { initializeApp, cert, deleteApp } from 'firebase-admin/app';
import { getFirestore } from 'firebase-admin/firestore';
import { assertExists } from '@std/assert';

Deno.test('test',
async () => {
// Initialize Cloud Firestore per https://firebase.google.com/docs/firestore/quickstart#initialize -> Node.js -> Initialize on your own server
const app = initializeApp({ credential: cert('service-account-key.json') });
const db = getFirestore(app);

const doc = await db.collection('test').doc('test').set({ foo: 42 });
assertExists(doc); // passes
await deleteApp(app); // doesn't help
await new Promise(resolve => setTimeout(resolve, 10 * 1000)); // doesn't help
}
);
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.