Merged
Size
S
Change Breakdown
Bug Fix85%
Security15%
#28268fix(Google Drive Node): Fix infinite pagination loop in v1 API request (backport to release-candidate/2.15.x)

Google Drive trigger infinite pagination loop fixed

The Google Drive trigger node could crash your n8n instance by polling the same page of results forever. A four-line fix prevents the infinite loop.

The Google Drive trigger node was crashing n8n instances by fetching the same page of results indefinitely. The pagination loop checked whether more pages existed but never advanced to the next one — so whenever an account had more than 100 modified files, the trigger kept re-fetching page one, accumulating results until the process ran out of memory.

The fix adds a single line that assigns the next page token to the query before looping again. This is the same pattern already used by every other Google API in the codebase — Gmail, Calendar, Sheets, YouTube. The v1 Google Drive function was the only one missing it.

Instances running Google Drive triggers on active accounts with heavy file activity should upgrade immediately. The fix prevents not just workflow execution failures but background memory growth that could crash the entire n8n process, even when no workflows were actively running.

View Original GitHub Description

Description

Backport of #28244 to release-candidate/2.15.x.

Checklist for the author (@BerniWittmann) to go through.

  • Review the backport changes
  • Fix possible conflicts
  • Merge to target branch

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 googleApiRequestAllItems function.

The function's do-while loop checked responseData.nextPageToken to decide whether to continue paginating, but never assigned query.pageToken = responseData.nextPageToken to 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

  1. Set up a Google Drive trigger node in specificFile mode polling a Google account with many files
  2. Verify the trigger polls correctly without memory growth
  3. Run the new unit test: cd packages/nodes-base && pnpm test nodes/Google/Drive/test/v1/GenericFunctions.test.ts

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-4565

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)
© 2026 · via Gitpulse