diff --git a/handwritten/firestore/dev/src/index.ts b/handwritten/firestore/dev/src/index.ts index 9889dd797090..36eb3e8a96a7 100644 --- a/handwritten/firestore/dev/src/index.ts +++ b/handwritten/firestore/dev/src/index.ts @@ -1895,7 +1895,12 @@ export class Firestore implements firestore.Firestore { request: {}, requestTag: string, ): Promise { - const callOptions = this.createCallOptions(methodName); + // gax ignores autoPaginate for stream paging methods (e.g. + // partitionQueryStream) and warns if it is not explicitly disabled. + const callOptions = { + ...this.createCallOptions(methodName), + autoPaginate: false, + }; const bidirectional = methodName === 'listen'; let numResponses = 0; diff --git a/handwritten/firestore/dev/test/partition-query.ts b/handwritten/firestore/dev/test/partition-query.ts index 3a3ecfd99f8f..71b8d8d90954 100644 --- a/handwritten/firestore/dev/test/partition-query.ts +++ b/handwritten/firestore/dev/test/partition-query.ts @@ -154,6 +154,19 @@ describe('Partition Query', () => { }); }); + it('disables autoPaginate for the stream request', async () => { + const overrides: ApiOverride = { + partitionQueryStream: (request, options) => { + expect(options?.autoPaginate).to.be.false; + return stream({values: [{referenceValue: DOC1}]}); + }, + }; + const firestore = await createInstance(overrides); + const query = firestore.collectionGroup('collectionId'); + const result = await getPartitions(query, 2); + expect(result.length).to.equal(2); + }); + it('does not issue RPC if only a single partition is requested', () => { const desiredPartitionsCount = 1;