gitlab打开group_member页面500错误
部署方式:k8s(gitlab-psql-redis)
版本:
注:当进入gitlab-rails c控制台时,可以使用Project. 加上两次tab,可以获取相关的方法
问题描述:打开group的member页面时500错误
进入gitlab,查看production.log提示错误如下:
Started GET "/groups/guangzhou_game_developer_team/-/group_members" for 10.244.21.15 at 2020-09-15 10:43:59 +0800 Processing by Groups::GroupMembersController#index as HTML Parameters: {"group_id"=>"guangzhou_game_developer_team"} Completed 500 Internal Server Error in 177ms (ActiveRecord: 55.3ms | Elasticsearch: 0.0ms | Allocations: 117863) ActionView::Template::Error (undefined method `name' for nil:NilClass): 119: data: { confirm: leave_confirmation_message(member.source) }, 120: class: "btn btn-remove align-self-center m-0 #{'ml-sm-2' unless force_mobile_view}" 121: - else 122: = link_to member, 123: method: :delete, 124: data: { confirm: remove_member_message(member), qa_selector: 'delete_member_button' }, 125: class: "btn btn-remove align-self-center m-0 #{'ml-sm-2' unless force_mobile_view}", app/helpers/members_helper.rb:18:in `remove_member_message' app/views/shared/members/_member.html.haml:122 app/views/groups/group_members/index.html.haml:70 app/controllers/application_controller.rb:125:in `render' 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' lib/gitlab/middleware/go.rb:20:in `call' lib/gitlab/etag_caching/middleware.rb:13:in `call' lib/gitlab/middleware/multipart.rb:121: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'
如上,日志提示进入 /groups/guangzhou_game_developer_team/-/group_members失败
原因google解释是:邀请了某人并随后删除了该用户,解决方式是到数据库下的members表中删除记录,这个记录字段invite_email不为空
参考以下链接:https://forum.gitlab.com/t/problem-with-group-manage-access/25293/2
由于本次环境是通过k8s部署的,相当于源码安装,所以很多功能都没法直接使用,如gitlab-rails,gitlab-rake等等都无法直接使用
需要用bundle exec,如gitlab-rails==bundle exec rails,gitlab-rake==bundle exec rake
使用gitlab-psql需要到postgresql容器上使用psql命令进入数据库内,删除gitlab-production库里面的members表记录
本次环境,psql的数据库为gitlab-production,删除表记录DELETE FROM members WHERE invite_email != ' ',gitlab连接数据库账号为gitlab
psql数据库操作参考链接:https://www.cnblogs.com/my-blogs-for-everone/p/10226473.html
导致原因参考链接:https://gitlab.com/gitlab-org/gitlab-foss/-/issues/49052