Skip to content

Random 'undefined local variable or method `project' ' in package pages, only in GDK

As per title while developing using GDK and reloading package list or details the page will start throwing:

undefined local variable or method 'project'

Once the error occurs workaround are:

  • navigate (with url manipulation ) away from the page, refresh then go back
  • restart GDK

Before the recent update to gdk run / gdk start another workaround would have been to run gdk run app and gdk run db in two separate shell

The error stop being 'random' and happens consistently after an error is 'done' in the ruby code or the haml views.

The error does not happen in any self managed instance / gitlab.com.

A screenshot of the first part of the code that fails

Screenshot_2019-10-22_at_16.28.01

I've tried to disable this part, and the project is missing both in the helper, in the controller and in the view

controller path ee/app/controllers/projects/packages/packages_controller.rb

This does not impact our clients at all, but it sometimes make the 'refresh' of the page take more than 2 minutes, and is very disruptive of the developer workflow.

I am posting here in GDK because it seems that this is narrowed to GDK but I am happy to move it / close it if this is not appropriate!

Please let me know if I can help in any way

Edit:

tail -f log/developement.log:

NameError - undefined local variable or method `project' for #<Projects::Packages::PackagesController:0x00007fed9230f3e0>
Did you mean?  project_url:
  ee/app/controllers/concerns/packages_access.rb:15:in `verify_packages_enabled!'
  ee/lib/gitlab/ip_address_state.rb:10:in `with'
  ee/app/controllers/ee/application_controller.rb:43:in `set_current_ip_address'
  lib/gitlab/session.rb:11:in `with_session'
  app/controllers/application_controller.rb:446: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:440:in `set_locale'
  lib/gitlab/middleware/rails_queue_duration.rb:27:in `call'
  lib/gitlab/metrics/rack_middleware.rb:17:in `block in call'
  lib/gitlab/metrics/transaction.rb:62:in `run'
  lib/gitlab/metrics/rack_middleware.rb:17:in `call'
  lib/gitlab/request_profiler/middleware.rb:17:in `call'
  lib/gitlab/query_limiting/middleware.rb:17:in `block in call'
  lib/gitlab/query_limiting/transaction.rb:39:in `run'
  lib/gitlab/query_limiting/middleware.rb:16: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/correlation_id.rb:16:in `block in call'
  lib/gitlab/middleware/correlation_id.rb:15:in `call'
  lib/gitlab/middleware/multipart.rb:117:in `call'
  lib/gitlab/middleware/read_only/controller.rb:48:in `call'
  lib/gitlab/middleware/read_only.rb:18:in `call'
  lib/gitlab/middleware/basic_health_check.rb:25:in `call'
  lib/gitlab/request_context.rb:32:in `call'
  config/initializers/fix_local_cache_middleware.rb:9:in `call'
  lib/gitlab/middleware/static.rb:11:in `call'
  lib/gitlab/webpack/dev_server_middleware.rb:27:in `perform_request'
  lib/gitlab/metrics/requests_rack_middleware.rb:49:in `call'
  lib/gitlab/middleware/release_env.rb:12:in `call'
Edited by Nicolò Maria Mezzopera