Skip to content

Dynamic-integration 'page' pagination returns 0 items for envelope APIs (dataPath extracted too late) #3545

Description

@eaarranz

Issue Summary

In the integration platform runtime, the page pagination strategy only works for APIs that return a bare JSON array. For envelope APIs — e.g. Hetzner Cloud (GET /v1/servers{"servers": [...], "meta": {...}}) — every fetchPages step silently yields 0 items on page 1, with no error.

Root cause (two cooperating pieces):

  1. fetchAllPages (packages/integration-platform/src/runtime/check-context.ts) checks the raw response: if (!Array.isArray(items) || items.length === 0) break; — an envelope object is not an array, so it breaks immediately and returns [].
  2. executeFetchPages (packages/integration-platform/src/dsl/interpreter.ts, case 'page') applies step.pagination.dataPath after fetchAllPages returns — by then the array is already empty, so the extraction never fires.

The cursor strategy does this correctly (it extracts dataPath per page inside fetchWithCursor). page should behave the same.

Steps to Reproduce

  1. Create a dynamic integration with baseUrl: "https://api.hetzner.cloud" and a check whose first step is {"type": "fetchPages", "path": "/v1/servers", "as": "servers", "pagination": {"strategy": "page", "pageParam": "page", "perPageParam": "per_page", "perPage": 50, "dataPath": "servers"}}.
  2. Connect with a valid read-only hcloud token for a project that has servers.
  3. Run the check.

Actual Results

  • Run logs: Fetching pages from /v1/serversFetched 0 items from /v1/serversIterating over 0 items in servers. Checks complete "successfully" with totalChecked: 0 — a vacuous pass that masks the problem.

Expected Results

  • The configured dataPath is applied to each page response, yielding the actual items (6 servers in our test project).

Technical details

  • Self-hosted Comp, integration platform runtime as of a 2026-07-29 checkout of main.
  • Suggested fix: pass dataPath into fetchAllPages (mirroring fetchWithCursor) and use it both for item extraction and for the stop condition (items.length < perPage).

Evidence

  • Reproduced consistently on our self-hosted deployment against the real Hetzner API (verified the same token/endpoints return data via curl). After switching the same checks to single fetch steps with dataPath + per_page=50, all 9 checks ran and returned real per-resource results — confirming only the page path is broken. Happy to attach run logs/screenshots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions