API returns an empty project members list
Summary
A call to /api/v4/projects/:id/members
returns an empty list "[]", even if the project have several members.
Steps to reproduce
The following call works:
$ curl -s --header "PRIVATE-TOKEN: xxxxxxxxxxxxxxxxxxxx" https://gitlab.example.com/api/v4/projects | jq
[
{
"id": 2,
"description": "Set of libraries for remote sensing images processing",
"default_branch": "master",
"tag_list": [],
...
}
]
But the following does not work, it returns an empty list but, actually, there are 13 members in this project:
$ curl -s --header "PRIVATE-TOKEN: xxxxxxxxxxxxxxxxxxxx" https://gitlab.example.com/api/v4/projects/2/members | jq
[]
Example Project
I created a project on Gitlab.com to reproduce the bug but, on Gitlab.com, the second call works and returns the right results (the members of the project). So, "it works for you!" :(
What is the current bug behavior?
The returned list is empty:
[]
What is the expected correct behavior?
The project members list:
[
{
"id": 772828,
"name": "Sebastien Dinot",
"username": "sdinot",
"state": "active",
...
}
]
Relevant logs and/or screenshots
/var/log/gitlab/gitlab-rails/api_json.log:
{"time":"2017-11-15T21:28:43.354Z","severity":"INFO","duration":25.79,"db":6.75,"view":19.04,"status":200,"method":"GET","path":"/api/v4/projects/2/members","params":{},"host":"gitlab.example.com","ip":"12.34.56.78, 127.0.0.1","ua":"curl/7.52.1"}
/var/log/gitlab/gitlab-rails/production.log
Started GET "/api/v4/projects/2/members" for 12.34.56.78 at 2017-11-15 22:38:14 +0100
Started GET "/-/metrics" for 127.0.0.1 at 2017-11-15 22:38:19 +0100
Processing by MetricsController#index as HTML
Filter chain halted as :validate_prometheus_metrics rendered or redirected
Completed 404 Not Found in 2ms (Views: 0.9ms | ActiveRecord: 0.0ms)
/var/log/gitlab/gitlab-rails/production_json.log
{"method":"GET","path":"/-/metrics","format":"html","controller":"MetricsController","action":"index","status":404,"duration":4.41,"view":0.74,"db":0.0,"time":"2017-11-15T21:34:34.966Z","params":{},"remote_ip":null,"user_id":null,"username":null}
/var/log/gitlab/gitlab-workhorse/current
2017-11-15_21:38:14.53846 gitlab.example.com 127.0.0.1:33902 - - [2017-11-15 22:38:14.506627411 +0100 CET] "GET /api/v4/projects/2/members HTTP/1.1" 200 2 "" "curl/7.52.1" 0.031680
Output of checks
It works on Gitlab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Debian 9.2 Current User: git Using RVM: no Ruby Version: 2.3.5p376 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.1.0 Redis Version: 3.2.5 Git Version: 2.13.6 Sidekiq Version:5.0.4 Go Version: unknown
GitLab information Version: 10.1.4 Revision: c887c03 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.example.com HTTP Clone URL: https://gitlab.example.com/some-group/some-project.git SSH Clone URL: git@gitlab.example.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: github, gitlab, bitbucket
GitLab Shell Version: 5.9.3 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...
GitLab Shell version >= 5.9.3 ? ... OK (5.9.3) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 39/1 ... ok 39/2 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 39/1 ... yes 39/2 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.5) Git version >= 2.7.3 ? ... yes (2.13.6) Git user has default SSH configuration? ... yes Active users: ... 35
Checking GitLab ... Finished