Skip to content

[Bug] Bitbucket plugin remote-scopes endpoint does not paginate — only returns first 100 repos #8999

Description

@fadwamrzk

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

Environment:

  • DevLake version: v1.0.3-beta15
  • Bitbucket Cloud
  • Workspace: ~1,266 repositories

Bug Description:
The /api/plugins/bitbucket/connections/:id/remote-scopes?groupId=<workspace>
endpoint only returns the first 100 repositories. The nextPageToken is empty,
so the UI shows no way to load more.

Root Cause:
The Bitbucket Cloud API returns paginated results (default pagelen=100).
The plugin appears to fetch only the first page and does not follow the
next link in the Bitbucket API response.

Evidence:

  • DevLake returns exactly 100 repos (sorted by creation date, oldest first)
  • Last repo returned was created 2021-10-06
  • Bitbucket API confirms 1,266 total repos:
    curl "https://api.bitbucket.org/2.0/repositories/<workspace>?pagelen=1&fields=size"
    returns {"size": 1266}

What do you expect to happen

Expected Behavior:
The plugin should either paginate through all results from the Bitbucket API,
or pass the Bitbucket next URL back as nextPageToken so the UI can
request subsequent pages.

How to reproduce

  1. Deploy DevLake v1.0.3-beta15 (Helm chart or docker-compose)
  2. Create a Bitbucket Cloud connection with an API-Token that has
    access to a workspace containing more than 100 repositories
  3. In the DevLake UI, go to Connections → Bitbucket → Add Data Scope
  4. Expand the workspace to browse repositories
  5. Observe that only 100 repositories are listed
  6. Note that nextPageToken is an empty string "", so there is no way
    to request the next page
  7. All 100 repos are the oldest in the workspace (sorted by creation date).
    Any repo created after the 100th one is inaccessible through the UI browse.

Verify actual repo count with Bitbucket API:
curl -u "user-email:api-token"
"https://api.bitbucket.org/2.0/repositories/?pagelen=1&fields=size"
Returns {"size": 1266}

Anything else

No response

Version

v1.0.3-beta15

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThis issue is a bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions