fix(Google Drive Node): Fix infinite pagination loop in v1 API request (backport to release-candidate/2.15.x)#28268
Merged
BerniWittmann merged 1 commit intorelease-candidate/2.15.xfrom Apr 10, 2026
Conversation
4 tasks
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant Trigger as Google Drive Trigger
participant Helpers as GenericFunctions (v1)
participant Auth as OAuth2 Helper
participant Google as Google Drive API
Note over Trigger,Google: Polling Flow for >100 Files
Trigger->>Helpers: googleApiRequestAllItems()
loop Pagination Loop
Helpers->>Auth: googleApiRequest(method, endpoint, query)
Auth->>Google: GET /drive/v3/files (with current pageToken)
Google-->>Auth: 200 OK (files[], nextPageToken)
Auth-->>Helpers: responseData
Helpers->>Helpers: Push items to returnData array
alt responseData.nextPageToken exists
Helpers->>Helpers: CHANGED: Update query.pageToken = responseData.nextPageToken
Note right of Helpers: Before fix, this update was missing,<br/>causing an infinite loop on page 1.
else No nextPageToken
Note right of Helpers: Loop terminates
end
end
Helpers-->>Trigger: return consolidated file list
Trigger->>Trigger: Process file changes
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Bundle ReportBundle size has no change ✅ Affected Assets, Files, and Routes:view changes for bundle: editor-ui-esmAssets Changed:
|
BerniWittmann
approved these changes
Apr 10, 2026
4d91dff
into
release-candidate/2.15.x
116 of 123 checks passed
Merged
Contributor
Author
|
Got released with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Backport of #28244 to
release-candidate/2.15.x.Checklist for the author (@BerniWittmann) to go through.
After this PR has been merged, it will be picked up in the next patch release for release track.
Original description
Summary
Fixes a memory leak in the Google Drive trigger node caused by an infinite pagination loop in the v1
googleApiRequestAllItemsfunction.The function's
do-whileloop checkedresponseData.nextPageTokento decide whether to continue paginating, but never assignedquery.pageToken = responseData.nextPageTokento advance to the next page. When the Google Drive API returned more than 100 results (one page), the same first page was re-fetched indefinitely, pushing ~100 items into an array per iteration until OOM.This bug only affects the v1 transport used by
GoogleDriveTrigger.node.ts. The v2 transport (used by the main Google Drive node) already had the correct implementation. Every other Google API pagination function in the codebase (Gmail, Calendar, Sheets, YouTube, etc.) also includes this assignment — the v1 Drive function was the only one missing it.Impact: Instances with active Google Drive trigger workflows polling accounts with >100 modified files experienced unbounded memory growth and repeated OOM crashes, even when no workflow executions were triggered.
How to test
specificFilemode polling a Google account with many filescd packages/nodes-base && pnpm test nodes/Google/Drive/test/v1/GenericFunctions.test.tsRelated Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/NODE-4565
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)