Skip to content

NameError: undefined local variable or method `request' for #<Grape::Middleware::Error:0x007fc990...

Created by @rymai.

https://sentry.gitlap.com/gitlab/gitlabcom/issues/12504/

NoMethodError: undefined method `id' for nil:NilClass
  app/models/ci/build.rb:294:in `dir_to_trace'
    project.id.to_s
  app/models/ci/build.rb:265:in `recreate_trace_dir'
    unless Dir.exist?(dir_to_trace)
  app/models/ci/build.rb:259:in `trace='
    recreate_trace_dir
  lib/ci/api/builds.rb:48:in `block (2 levels) in <class:Builds>'
    build.update_attributes(trace: params[:trace]) if params[:trace]
  lib/gitlab/request_profiler/middleware.rb:15:in `call'
    @app.call(env)
...
(130 additional frame(s) were not displayed)

NameError: undefined local variable or method `request' for #<Grape::Middleware::Error:0x007fc990b22580>
Did you mean?  require
  lib/api/helpers.rb:28:in `find_user_from_warden'
    warden.try(:authenticate) if request.get? || request.head?
  lib/gitlab/metrics/instrumentation.rb:155:in `block in find_user_from_warden'
    trans.method_call_for(#{label.to_sym.inspect}).measure { super }
  lib/gitlab/metrics/method_call.rb:23:in `measure'
    retval = yield
  lib/gitlab/metrics/instrumentation.rb:155:in `find_user_from_warden'
    trans.method_call_for(#{label.to_sym.inspect}).measure { super }
  lib/api/helpers.rb:41:in `current_user'
    @current_user ||= find_user_from_warden
...
(112 additional frame(s) were not displayed)