undefined method `migration_bot?' for nil:NilClass if no session

Summary

I noticed that I get

NoMethodError at /groups/flightjs/-/settings/access_tokens
undefined method `migration_bot?' for nil:NilClass

Hint: Something is `nil` when it probably shouldn't be.

when opening http://localhost:3000/groups/flightjs/-/settings/access_tokens in incognito in GDK.

(or https://gitlab.com/groups/alipniagov-test/-/settings/access_tokens on .com)

Steps to reproduce

  1. Pull latest master
  2. Open incognito or sign out
  3. Open http://localhost:3000/groups/flightjs/-/settings/access_tokens
  4. You should see 500

On .com, you could just https://gitlab.com/groups/alipniagov-test/-/settings/access_tokens (or with other group) in incognito or signed out

Example Project

What is the current bug behavior?

500 when no @user, calling method on nil

What is the expected correct behavior?

404 instead of 500

Relevant logs and/or screenshots

Screenshot_2022-10-24_at_12.46.52

Output of checks

This bug happens on GitLab.com : https://gitlab.com/groups/alipniagov-test/-/settings/access_tokens

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

See attached MR

Edited Oct 25, 2022 by Aleksei Lipniagov
Assignee Loading
Time tracking Loading