Intermittent HTTP 520 error when using repository/commits endpoint
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
I sometimes get an HTTP 520 error (which may be coming from CloudFlare) when using the repository/commits API endpoint. This happens maybe 1 in 5 requests, and happens with the exact same request body (i.e. nothing about the request is different, if I submit again it works). It seems related to the size of the payload though, I experience it less with smaller commits.
Steps to reproduce
- The request body I'm reproducing with is like this:
body = {
"branch": self.branch_name,
"commit_message": commit_message,
"actions": [
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
{
"file_path": file_path,
"action": "update",
"content": content,
"author_email": author_email,
"author_name": author_name,
},
],
}
There are 9 actions, and the content in each is a lot of YAML. The total body size when exported to JSON is 176609 bytes.
- Using this body, submit POST request to https://gitlab.com/api/v4/projects/<project_id>/repository/commits
What is the current bug behavior?
Every several requests I get an HTTP 520 error (error message in the log section) and the commit fails.
What is the expected correct behavior?
I would expect the commit to work properly every time.
Relevant logs and/or screenshots
This is the content of the 520 error:
b'<!DOCTYPE html>\n<html>\n<head>\n <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">\n <title>500 Error - GitLab</title>\n <style>body{align-items:center;color:#666;display:flex;flex-direction:column;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:14px;justify-content:center;margin:auto;text-align:center}hr{border:0;border-bottom:1px solid #fff;border-top:1px solid #eee;margin:18px auto;max-width:800px}img{max-width:40vw}.container{margin:auto 20px}.cferror_details{list-style-type:none}.cf-error-details h1{color:#456;font-size:20px;font-weight:400;line-height:28px}</style>\n\n\n</head>\n\n<body>\n <h1>\n <img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjE5MiIgdmlld0JveD0iMCAwIDI1IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxwYXRoIGQ9Im0yNC41MDcgOS41LS4wMzQtLjA5TDIxLjA4Mi41NjJhLjg5Ni44OTYgMCAwIDAtMS42OTQuMDkxbC0yLjI5IDcuMDFINy44MjVMNS41MzUuNjUzYS44OTguODk4IDAgMCAwLTEuNjk0LS4wOUwuNDUxIDkuNDExLjQxNiA5LjVhNi4yOTcgNi4yOTcgMCAwIDAgMi4wOSA3LjI3OGwuMDEyLjAxLjAzLjAyMiA1LjE2IDMuODY3IDIuNTYgMS45MzUgMS41NTQgMS4xNzZhMS4wNTEgMS4wNTEgMCAwIDAgMS4yNjggMGwxLjU1NS0xLjE3NiAyLjU2LTEuOTM1IDUuMTk3LTMuODkuMDE0LS4wMUE2LjI5NyA2LjI5NyAwIDAgMCAyNC41MDcgOS41WiIKICAgICAgICBmaWxsPSIjRTI0MzI5Ii8+CiAgPHBhdGggZD0ibTI0LjUwNyA5LjUtLjAzNC0uMDlhMTEuNDQgMTEuNDQgMCAwIDAtNC41NiAyLjA1MWwtNy40NDcgNS42MzIgNC43NDIgMy41ODQgNS4xOTctMy44OS4wMTQtLjAxQTYuMjk3IDYuMjk3IDAgMCAwIDI0LjUwNyA5LjVaIgogICAgICAgIGZpbGw9IiNGQzZEMjYiLz4KICA8cGF0aCBkPSJtNy43MDcgMjAuNjc3IDIuNTYgMS45MzUgMS41NTUgMS4xNzZhMS4wNTEgMS4wNTEgMCAwIDAgMS4yNjggMGwxLjU1NS0xLjE3NiAyLjU2LTEuOTM1LTQuNzQzLTMuNTg0LTQuNzU1IDMuNTg0WiIKICAgICAgICBmaWxsPSIjRkNBMzI2Ii8+CiAgPHBhdGggZD0iTTUuMDEgMTEuNDYxYTExLjQzIDExLjQzIDAgMCAwLTQuNTYtMi4wNUwuNDE2IDkuNWE2LjI5NyA2LjI5NyAwIDAgMCAyLjA5IDcuMjc4bC4wMTIuMDEuMDMuMDIyIDUuMTYgMy44NjcgNC43NDUtMy41ODQtNy40NDQtNS42MzJaIgogICAgICAgIGZpbGw9IiNGQzZEMjYiLz4KPC9zdmc+Cg==" alt="GitLab" /><br />\n </h1>\n <div class="container">\n <div class="cf-error-details cf-error-520">\n <h1>Web server is returning an unknown error</h1>\n <p>There is an unknown connection issue between Cloudflare and the origin web server. As a result, the web page can not be displayed.</p>\n <ul>\n <li>Ray ID: 880458717e978d9c</li>\n <li>Your IP address: 177.236.116.152</li>\n <li>Error reference number: 520</li>\n <li>Cloudflare Location: Miami</li>\n </ul>\n</div>\n\n <hr />\n <p>Please see our <a href="https://status.gitlab.com">status page</a> for more information.</p>\n </div>\n</body>\n</html>\n'
Output of checks
This bug happens on GitLab.com