Forums

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

Getting 500 Internal Server Error when trying to push changes using Bitbucket APIs

anubhav vats June 1, 2021

Sometimes while using this API https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/src#post

I am getting a response with a 500 status code. The response body does not contain enough information to debug it. Please help me in this regard.

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.
June 2, 2021

Hi @anubhav vats  and welcome to the community

1. Could you please copy-paste the full response you get (omitting sensitive info, if any)? Usually, in responses with 500 error there is an id included, which I could look up in our system for further info.

2. If you are able to reproduce this, could you check how much time it takes from the moment you execute the API call, until you get this response? One possibility is that the request may be timing out.

3. What is the approximate number of files and their size you are trying to commit/push with this endpoint, when you get these errors?

4. Since you mention "sometimes", I assume that the issue doesn't occur every time you use this endpoint, and it did not happen only once, but there were a few times that this happened, when you were trying to create different commits? (Just trying to understand the scope of the issue)

Kind regards,
Theodora

anubhav vats June 3, 2021

Thanks, @Theodora Boudale for looking into this issue.


1. {
type: 'error',
error: {
message: 'Something went wrong',
id: '96eb231e4d684d8c978d4c0aa663bdf1'
}
}
I am getting this response. Please debug on your system why this is happening.

2. I reproduced the error and found it takes about 1696.595 ms to get a response with status code 500.

3. I am just trying to push change for one single file with a size of 2.3 KB.

4. Yes you are understanding the issue correctly. I also want to add that I get 500 for the same repository every time and I have read, write and admin access to that repo. 

Like Mudit Mehta likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 4, 2021

Hi @anubhav vats ,

Thank you for the info.

I checked this error code in our system, and I see the error message:

pre-receive hook exited with 1

One of your commit messages is missing a valid issue key:

After that, a specific commit with its commit message is displayed, but I have omitted it because I am unsure if you'd like me to post it here.

Based on the error message, it looks that the option "Require issue keys in commit messages" may be enabled for this repository. This is possible if you have linked with JIRA or with another external application. You can double check that if you go to Repository settings > Links, is the option "Require issue keys in commit messages" enabled for the repo you are trying to push?

If so, you'll need to include a valid issue key in the commit message for the call to succeed.

One example:

curl -X POST -u username:app-password https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo-slug>/src -F File2.json=@File1.json -F branch=test-branch -F message="my commit message TEST-123"

Where TEST-123 replace with a valid issue key for your case.

Is this something that works for you?

Please feel free to let me know how it goes and if you need any further help.

Kind regards,
Theodora

Like anubhav vats likes this
anubhav vats June 7, 2021

@Theodora Boudale Thanks a lot man!!! Because of your help, I was able to complete my work. Great thanks to you.

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 7, 2021

@anubhav vats , you are very welcome! I'm glad to have helped and that the issue is resolved.

Please feel free to reach out if you ever need anything else!

Have a nice day,
Theodora

Anthony Nguyen
Contributor
October 31, 2024

@Theodora Boudale I am running into a very ambiguous 500 Internal Server Error when trying to use update pull request to change a pull request's title. The error message is too vague for me to know what the issue is. If possible, could you please take a look at e5b1df83f6244e2bae3c7c4970a9f1df?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 1, 2024

Hi Anthony,

I see that you created a question about this issue here: https://community.atlassian.com/t5/Bitbucket-questions/Response-500-from-trying-BitBucket-update-pull-request-api-call/qaq-p/2854606

The question was created within the Jira collection; I moved it to the Bitbucket collection, since it's related to an error coming from Bitbucket's API.

I will look into it and reply in that question.

Kind regards,
Theodora

Like Anthony Nguyen likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events