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

Đang mở Phù hợp với người mới
#3,319 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
google-cloud, node.js, typescript
Lĩnh vực
backend, devtools

Hướng nghiên cứu

Bắt đầu bằng cách đọc siêu dữ liệu gói khai báo @google-cloud/storage là phần phụ thuộc tùy chọn và kiểm tra các bài kiểm tra tương thích phần phụ thuộc hiện có. Mở rộng phạm vi được hỗ trợ để bao gồm ^9.0.0, sau đó chạy bộ kiểm tra liên quan và xác nhận Storage 9 được chấp nhận. Công việc hoàn tất khi phạm vi đã khai báo và các bài kiểm tra hỗ trợ phiên bản chính mới.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
429
Merge trung bình
4 ngày 19 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/firebase-admin-node

Tất cả issue của firebase/firebase-admin-node

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.