[FR] Allow @google-cloud/storage v9 — v8 emits MaxListenersExceededWarning on every download (teeny-request stream path)

Offen Anfängerfreundlich
#3,319 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
62/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
google-cloud, node.js, typescript
Bereich
backend, devtools

Rechercherichtung

Lies zunächst die Paketmetadaten, die @google-cloud/storage als optionale Abhängigkeit deklarieren, und prüfe die vorhandenen Tests zur Abwärtskompatibilität von Abhängigkeiten. Erweitere den unterstützten Versionsbereich um ^9.0.0, führe dann die relevanten Tests aus und bestätige, dass Storage 9 akzeptiert wird. Die Aufgabe ist abgeschlossen, wenn der deklarierte Versionsbereich und die Tests die neue Hauptversion unterstützen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Is your feature request related to a problem? Please describe.

[email protected] declares @google-cloud/storage as ^8.1.0 (optionalDependencies), so an Admin SDK app resolves Storage 8.4.0. On that version every File.createReadStream() / File.download() emits a MaxListenersExceededWarning:

(node:1) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [PassThrough]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
(node:1) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [PassThrough]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit

(These are copied verbatim from our production logs. The error and close warnings arrive as a pair, within a millisecond of each other.)

It is not a leak (heap stays flat over hundreds of downloads). But Node prints it to stderr, outside any structured logger, and to anyone reading the logs it looks like a leak.

The cause, as far as we traced it (Storage 8.4.0, teeny-request 11.1.1, Node 24):

  • teeny-request's stream mode pipes the response into its requestStream PassThrough (teeny-request/build/src/index.js, pipeline(responseStream, requestStream, ...));
  • Storage's createReadStream pipes that same raw response stream again, into its throughStream (@google-cloud/storage/build/cjs/src/file.js, pipeline(rawResponseStream, ...transformStreams, throughStream, onComplete));
  • together with node-fetch's own pipeline, three stream.pipeline calls attach their error and close listeners to the one PassThrough, which crosses the default limit of 10.

@google-cloud/[email protected] (released 2026-11-12) no longer depends on teeny-request (it uses gaxios 8), which removes this code path. We have not yet confirmed that the warning is gone on Storage 9; we're inferring it from the dependency change. Admin SDK users can't take Storage 9 without an overrides entry outside the SDK's declared range.

Describe the solution you'd like

Widen the @google-cloud/storage range to allow ^9.0.0 (its engines is node >=22, the same as firebase-admin@14), once it passes your test suite.

Describe alternatives you've considered

  • npm overrides forcing Storage 9: it works around the warning, but it runs the app on a Storage major the SDK hasn't been tested against.
  • emitter.setMaxListeners() / --no-warnings: these hide the symptom and also hide real listener leaks.

Additional context

  • firebase-admin 14.5.0 / 14.5.1, @google-cloud/storage 8.4.0, teeny-request 11.1.1, Node.js 24.
  • We've seen it both in production (Cloud Run, Node 24) and against the Firebase Storage emulator.
Vorherrschende Sprache
TypeScript
Sterne
1.8k
Forks
429
Ø Merge
4 T. 19 Std.
Gemergte PRs (30 T.)
14

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus firebase/firebase-admin-node

Alle Issues in firebase/firebase-admin-node

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.