Skip to content

Error 500 when inviting user to a few projects

Summary

When I try to invite a user to a few specific projects we have, the invite attempt results in a 500 error. Most projects work fine, just some don't. It doesn't matter who I invite - it's always a 500 on these projects. Inviting users to the group above does work.

Steps to reproduce

  1. Find a project that gives a 500 error when you invite a user
  2. Invite a user to that project

I realize this is really not super helpful, but I have error logs...

Example Project

I don't think this is possible. It seems entirely random.

What is the current bug behavior?

500 when trying to invite user to project.

What is the expected correct behavior?

User is invited to project.

Relevant logs and/or screenshots

==> /var/log/gitlab/production.log <==
Started POST "/lightning_badger/dap/-/project_members" for 10.36.4.6 at 2020-04-16 15:31:00 +0000
Processing by Projects::ProjectMembersController#create as HTML
 
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "user_ids"=>"35", "access_level"=>"10", "expires_at"=>"", "namespace_id"=>"lightning_badger", "project_id"=>"dap"}
 
{"exception.class":"NoMethodError","params":[{"key":"utf8","value":"✓"},{"key":"authenticity_token","value":"[FILTERED]"},{"key":"user_ids","value":"35"},{"value":"10","key":"access_level"},{"value":"","key":"expires_at"},{"value":"lightning_badger","key":"namespace_id"},{"value":"dap","key":"projec… 
Completed 500 Internal Server Error in 68ms (ActiveRecord: 18.5ms | Elasticsearch: 0.0ms | Allocations: 17122)
 
==> /var/log/gitlab/production_json.log <==
 
==> /var/log/gitlab/production.log <==

NoMethodError (undefined method `root_ancestor' for nil:NilClass):

ee/lib/gitlab/auth/group_saml/gma_membership_enforcer.rb:26:in `check_source_project_membership'
ee/lib/gitlab/auth/group_saml/gma_membership_enforcer.rb:12:in `can_add_user?'
ee/app/models/ee/project_member.rb:28:in `gma_enforcement'
app/models/member.rb:187:in `add_user'
app/models/member.rb:213:in `block (2 levels) in add_users'
app/models/member.rb:212:in `map!'
app/models/member.rb:212:in `block in add_users'
app/models/member.rb:211:in `add_users'
app/models/project_team.rb:48:in `add_users'
ee/app/models/ee/project_team.rb:12:in `add_users'
app/models/project.rb:346:in `add_users'
app/services/members/create_service.rb:15:in `execute'
app/controllers/concerns/membership_actions.rb:9:in `create'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
ee/app/controllers/ee/application_controller.rb:43:in `set_current_ip_address'
app/controllers/application_controller.rb:479:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:470:in `set_session_storage'
lib/gitlab/i18n.rb:55:in `with_locale'
lib/gitlab/i18n.rb:61:in `with_user_locale'
app/controllers/application_controller.rb:464:in `set_locale'
lib/gitlab/error_tracking.rb:34:in `with_context'
app/controllers/application_controller.rb:555:in `sentry_context'
lib/gitlab/application_context.rb:46:in `block in use'
lib/gitlab/application_context.rb:46:in `use'
lib/gitlab/application_context.rb:19:in `with_context'
app/controllers/application_controller.rb:455:in `set_current_context'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
ee/lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:13:in `call'
lib/gitlab/middleware/multipart.rb:122:in `call'
lib/gitlab/middleware/read_only/controller.rb:53:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:23:in `call'
config/initializers/fix_local_cache_middleware.rb:9:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:49:in `call'
lib/gitlab/middleware/release_env.rb:12:in `call'

Output of checks

(Please note I am running gitlab on Kubernetes, so some of these always fail)

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 12.0.0 ? ... OK (12.0.0)
Running /home/git/gitlab-shell/bin/check
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /home/git/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... no
  Try fixing it:
  sudo -u git -H RAILS_ENV=production bin/background_jobs start
  For more information see:
  doc/install/installation.md in section "Install Init Script"
  see log/sidekiq.log for possible errors
  Please fix the error above and rerun the checks.

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... no
Trying to fix error automatically. ...Failed
  Try fixing it:
  sudo -u git -H "/usr/bin/git" config --global core.autocrlf "input"
  For more information see:
  doc/install/installation.md in section "GitLab"
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? ... skipped (no tmp uploads folder yet)
Init script exists? ... no
  Try fixing it:
  Install the init script
  For more information see:
  doc/install/installation.md in section "Install Init Script"
  Please fix the error above and rerun the checks.
Init script up-to-date? ... can't check because of previous errors
Projects have namespace: ...

...snip...

Lightning_Badger / dap ... yes

...snip...

Redis version >= 2.8.0? ... no
  Try fixing it:
  Update your redis server to a version >= 2.8.0
  For more information see:
  gitlab-public-wiki/wiki/Trouble-Shooting-Guide in section sidekiq
  Please fix the error above and rerun the checks.
Ruby version >= 2.5.3 ? ... yes (2.6.5)
Git version >= 2.22.0 ? ... no
Your git bin path is "/usr/bin/git"
  Try fixing it:
  Update your git to a version >= 2.22.0 from Unknown
  Please fix the error above and rerun the checks.
Git user has default SSH configuration? ... yes
Active users: ... 21
Is authorized keys file accessible? ... skipped (authorized keys not enabled)
Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

Results of GitLab environment info

System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.6.5p114
Gem Version:    2.7.10
Bundler Version:1.17.3
Rake Version:   12.3.3
Redis Version:  unknown
Git Version:    unknown
Sidekiq Version:5.2.7
Go Version:     unknown

GitLab information
Version:        12.9.3-ee
Revision:       7c13691fb8e
Directory:      /srv/gitlab
DB Adapter:     PostgreSQL
DB Version:     11.6
URL:            https://gitlab.xxx.yyy
HTTP Clone URL: https://gitlab.xxx.yyy/some-group/some-project.git
SSH Clone URL:  git@gitlab.xxx.yyy:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: openid_connect

GitLab Shell
Version:        12.0.0
Repository storage paths:
- default:      /var/opt/gitlab/repo
GitLab Shell path:              /home/git/gitlab-shell
Git:            /usr/bin/git
Edited by Gerard