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

オープン 初心者向け
#3,319 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
62/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
google-cloud, node.js, typescript
領域
backend, devtools

調査の方向性

まず、@google-cloud/storageをオプション依存関係として宣言しているパッケージメタデータを読み、既存の依存関係互換性テストを確認してください。サポート対象の範囲を広げて^9.0.0を含め、関連するテストスイートを実行して、Storage 9が受け入れられることを確認してください。宣言された範囲とテストが新しいメジャーバージョンをサポートすれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
TypeScript
スター
1.8k
フォーク
429
平均マージ
4日 19時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

firebase/firebase-admin-node のほかの issue

firebase/firebase-admin-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。