Skip to content

Failed to paginate through all Cloudflare Pages deployments #2680

@SukkaW

Description

@SukkaW

Confirm this is a Typescript library issue and not an underlying Cloudflare API issue

  • This is an issue with the Typescript library

Describe the bug

I am attempting to paginate all pages of my cloudflare pages deployment items in cloudflare, but pages.projects.deployments.list never returns all results:

const client = new Cloudflare({
  apiToken: cloudflareApiToken
});

for await (const project of await client.pages.projects.list({
  account_id
  // The typescript assertion is required due to https://github.com/cloudflare/cloudflare-typescript/issues/2489
}) as AsyncIterable<Cloudflare.Pages.Project>) {
    for await (const deployment of await client.pages.projects.deployments.list(project.name, {
      account_id,
      per_page: 1 // intentionally using a very small `per_page` to re-produce the issue
    })) {
      // this loop only run 1 time and no more
    }
}

And hasNextPage() always returns false.

To Reproduce

  1. Use cloudflare version 5.1.0
  2. Run the above code snippets

Code snippets

// See above

OS

macOS

Runtime version

TypeScript 5.9.2, Node.js v22.19.0

Library version

v5.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions