Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting 404 error when fetching commit data, despite successfully fetching repositories and PRs?

Amin Lajmi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 29, 2023

I'm facing an issue with our custom integration that is designed to fetch the list of repositories, pull requests, and commits. The calls are made with a token generated using OAuth consumer authorised by an admin user.
I am able to retrieve the list of repositories and pull requests successfully, but when attempting to fetch the commit data, in some cases I receive a 404 error with the message "The source or destination could not be found."

Here's a description of the issue I'm encountering, highlighting the steps and relevant details:

  1. The custom integration uses OAuth consumers to authorize access for admin users.
  2. The purpose of the custom integration is to gather the repositories, pull requests, and commits data of third party workspaces (so the specific setup of those workspaces are unknown).
  3. The admin token generated from OAuth has the following scopes: account, pullrequest, issue, webhook, and team.
  4. The first two API calls to fetch repositories and pull requests data work as expected, returning the desired data.
  5. When attempting to fetch the commit data (third call), a 404 error is encountered, with the message "The source or destination could not be found."

Steps Taken to Solve the Problem:

I have attempted the following steps to resolve the issue:

  1. Double-checked the API call URLs to ensure they are valid and correspond to the proper endpoints.
  2. Verified the admin token permissions to make sure it has the required access rights to fetch commit data.
  3. Looked through Bitbucket's API documentation for any necessary changes in query parameters or requirements for fetching commit data.
  4. Ensured that the OAuth consumer is properly configured for admin users.

Unfortunately, after trying the above troubleshooting steps, the problem persists.

The API call URL format is: https://api.bitbucket.org/2.0/repositories/<workspace-name>/<repository-name>/pullrequests/<pullrequet-id>/commits?pagelen=10

Screenshots:

To provide more context, I've included the following screenshot for OAuth consumer permissions:

Screenshot 2023-09-29 at 15.58.13.png

I would appreciate any guidance or suggestions from the community regarding the possible causes of this issue and how it might be resolved. Are there any additional steps I should take to further troubleshoot the problem, or any known issues that could be causing such an error when using OAuth consumers for admin users?

Thank you in advance for your help!

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 2, 2023

Hi Amin and welcome to the community!

This error doesn't have anything to do with the OAuth consumer, it occurs when the list of commits involved in the PR doesn't exist. This can happen if someone rewrites history or rebases and with a force push removes commits associated with a pull request. The API then returns a 404 error with this message since the list of commits doesn't exist.

Kind regards,
Theodora

Amin Lajmi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 5, 2023

@Theodora Boudale Thank you for your response.

Like Theodora Boudale likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events