Gitlab Project languages API returns a 502 response
Summary
(Summarize the bug encountered concisely)
The Gitlab's Project languages API is unstable for production use as it returns a 502 response for certain projects when using this API
Steps to reproduce
(How one can reproduce the issue - this is very important)
- Use the Gitlab's Project languages API with the example project, by forking the project to your own account
- 502 error is encountered
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
What is the current bug behavior?
(What actually happens)
A 502 response is returned for some projects, with a 'Gitlab is not responding' message.
What is the expected correct behavior?
(What you should see instead)
An appropriate response should be returned instead of the 502 error as 502 status might be actually used to denote other appropriate cases. Also the response message seems to indicate something is failing on the API's server end.
The expected response of this API endpoint is the list of languages for the Project. If the Project is empty, then maybe an empty list should be returned with 200. Otherwise, if any other error occurred, the response should give more clarity into why the response failed, e.g. 403 for unauthorized access
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output,
logs, and code as it's very hard to read otherwise.)

Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com) This bug happens on the public API provided by GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)