Overview
Bitbucket users may encounter build Error on CircleCI or when clicking job page see Not Found due to API rate limiting. This issue arises when CircleCI exceeds Bitbucket's API request limits for the user, preventing necessary data retrieval for builds. The default rate limit is 1,000 requests per hour per user or access token. This article provides solutions to mitigate these rate limits and ensure smooth CI/CD operations.
Prerequisites
- Access to Bitbucket and CircleCI accounts.
- Administrative privileges to manage Bitbucket projects and repositories.
- CircleCI personal API token.
How to Check If You're Affected
You can quickly test whether your account is being rate limited by running the following curl command:
curl -vvvv --http1.1 -X POST \
https://circleci.com/api/v2/project/bitbucket/{workspace}/{repository}/pipeline \
-H 'content-type: application/json' \
-u "${CIRCLECI_TOKEN}:"Replace {workspace} and {repository} with your actual Bitbucket workspace and repository names, and ${CIRCLECI_TOKEN} with your CircleCI personal API token.
If you're being rate limited, you'll see a response like:
{
"message": "Your VCS provider has rate limited you."
}Recommended Workarounds
-
Use Bitbucket Access Tokens:
- If your Bitbucket workspace has a paid plan with more than 100 users, create workspace, project, or repository access tokens. https://support.atlassian.com/bitbucket-cloud/docs/api-request-limits/#Scaled-rate-limits
- Update your CircleCI integration to use these tokens instead of user-based OAuth authentication.
-
Space Out Repository Operations:
- Avoid pushing to multiple repositories simultaneously to reduce API request volumes.
-
Limit Project Access per User:
- Reduce the number of projects a user has access to, ideally fewer than 10 projects, to distribute the API load.
-
Create Additional Service Accounts:
- If restructuring project access is difficult, create additional Bitbucket service accounts to distribute API requests across different accounts.
Comments
Article is closed for comments.