firestore: getPartitions() emits gax AutopaginateTrueWarning in every process

Đang mở Phù hợp với người mới
#9,736 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 1 ngày

@TheRealDanii đang làm issue này rồi.

Từ ngày 4/11/2026.

  • #9816 của @TheRealDanii — đang mở

Đá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
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại handwritten/firestore/dev/src/index.ts và lần theo Firestore.requestStream() đến createCallOptions(), kiểm tra cách các tùy chọn được truyền đến lệnh gọi phân trang stream của gax. Đặt autoPaginate thành false trong các tùy chọn gọi stream. Sau đó, xác minh getPartitions() hoàn tất mà không có cảnh báo và vẫn đọc các phân vùng qua nhiều trang.

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

Mô tả

api: firestore

Library: @google-cloud/firestore 7.11.3 (through firebase-admin 13.10.0), google-gax 4.6.1, Node.js 24. The same code is on main in handwritten/firestore/dev/src/index.ts.

Reproduction
// npm i @google-cloud/[email protected]
// FIRESTORE_EMULATOR_HOST=127.0.0.1:9 node repro.cjs
const {Firestore} = require('@google-cloud/firestore');
process.on('warning', w => console.log('warning event:', w.name));
const db = new Firestore({projectId: 'demo-repro'});
(async () => {
  for await (const _ of db.collectionGroup('any').getPartitions(2)) {}
})().catch(() => {});

No server is necessary: the warning is emitted when the request is built. Output:

(node:1) AutopaginateTrueWarning: Autopaginate will always be set to false in stream paging methods. See more info at https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#auto-pagination for more information on how to configure paging calls
warning event: AutopaginateTrueWarning
Cause

Firestore.requestStream() uses the call options from createCallOptions(), which do not set autoPaginate. gax's CallSettings sets autoPaginate to true when the option is not given. PageDescriptor.createStream() then warns for partitionQueryStream, a stream paging method, and forces autoPaginate: false. The caller cannot change this, because getPartitions() accepts no call options.

Expected

No warning. The partitions are read correctly; only the warning is wrong.

Why it matters

Node writes the warning to stderr. Cloud Run and Cloud Functions record stderr at severity ERROR, so each process that calls getPartitions() creates an Error Reporting event. googleapis/nodejs-firestore#2335 reported the same class of problem for listDocuments().

Suggested fix

Set autoPaginate: false on the call options in requestStream(). gax already uses that value for every stream paging method, and streams without paging ignore it. We apply this one-line change as a local patch. With the patch, a fake server that returns PartitionQuery results in two pages gives the same partitions and no warning.

Ngôn ngữ chính
TypeScript
Star
3.2k
Fork
732
Merge trung bình
3 ngày 7 giờ
Pull request đã merge (30 ngày)
117

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 googleapis/google-cloud-node

Tất cả issue của googleapis/google-cloud-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.