rails-engine/notifications

Deployment on heroku: alias_method 'current_user' undefined

raddrick opened this issue · 1 comments

The integration works fine in development, but this is preventing my app from starting in heroku

I see that the codebase does define current user in the controller, but it seems to be breaking during the startup of the app after the build.

I am using devise 4.6.2, rails 5.2, ruby 2.6.0

2019-08-11T07:27:05.920574+00:00 heroku[web.1]: State changed from crashed to starting
2019-08-11T07:27:10.246313+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 23752 -e production`
2019-08-11T07:27:15.427833+00:00 heroku[web.1]: State changed from starting to crashed
2019-08-11T07:27:15.409030+00:00 heroku[web.1]: Process exited with status 1
2019-08-11T07:27:15.316165+00:00 app[web.1]: /app/vendor/bundle/ruby/2.5.0/gems/notifications-0.6.1/app/controllers/notifications/application_controller.rb:5:in `alias_method': undefined method `current_user' for class `Notifications::ApplicationController' (NameError)

I do see it in https://github.com/rails-engine/notifications/blob/master/app/controllers/notifications/application_controller.rb I am using the defaults for current_user and authenticate_user!

could it be that it is getting loaded before devise?

heroku[web.1]: State changed from starting to crashed
heroku[web.1]: Process exited with status 1
app[web.1]: /app/vendor/bundle/ruby/2.6.0/gems/notifications-0.6.0/app/controllers/notifications/application_controller.rb:5:in alias_method': undefined method current_user' for class Notifications::ApplicationController' (NameError) app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/notifications-0.6.0/app/controllers/notifications/application_controller.rb:5:in class:ApplicationController'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/notifications-0.6.0/app/controllers/notifications/application_controller.rb:2:in <module:Notifications>' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/notifications-0.6.0/app/controllers/notifications/application_controller.rb:1:in <top (required)>'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in require' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in block in require'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in load_dependency' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in require'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:370:in block in require_or_load' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:37:in block in load_interlock'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:14:in block in loading' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/concurrency/share_lock.rb:151:in exclusive'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies/interlock.rb:13:in loading' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:37:in load_interlock'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:348:in require_or_load' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:326:in depend_on'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:242:in require_dependency' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/engine.rb:478:in block (2 levels) in eager_load!'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/engine.rb:477:in each' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/engine.rb:477:in block in eager_load!'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/engine.rb:475:in each' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/engine.rb:475:in eager_load!'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/engine.rb:356:in eager_load!' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:69:in each'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/application/finisher.rb:69:in block in <module:Finisher>' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in instance_exec'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in run' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in block in run_initializers'
app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:228:in block in tsort_each' app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:431:in each_strongly_connected_component_from' app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:349:in block in each_strongly_connected_component'
app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in each' app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in call'
app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in each_strongly_connected_component' app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:226:in tsort_each'
app[web.1]: from /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:205:in tsort_each' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in run_initializers'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/application.rb:361:in initialize!' app[web.1]: from /app/config/environment.rb:5:in <top (required)>'
app[web.1]: from config.ru:3:in require_relative' app[web.1]: from config.ru:3:in block in

'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in instance_eval' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in initialize'
app[web.1]: from config.ru:in new' app[web.1]: from config.ru:in '
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in eval' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in new_from_string'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in parse_file' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/server.rb:319:in build_app_and_options_from_config'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/server.rb:219:in app' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:27:in app'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/server.rb:354:in wrapped_app' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/rack-2.0.7/lib/rack/server.rb:283:in start'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:53:in start' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in block in perform'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in tap' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in perform'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in run' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in invoke_command'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in dispatch' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/command/base.rb:65:in perform'
app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/command.rb:46:in invoke' app[web.1]: from /app/vendor/bundle/ruby/2.6.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in <top (required)>'
app[web.1]: from bin/rails:9:in require' app[web.1]: from bin/rails:9:in '
app[web.1]: => Booting Puma
app[web.1]: => Rails 5.2.0 application starting in production
app[web.1]: => Run rails server -h for more startup options
app[web.1]: Exiting