Failed to bootstrap due to plugins using deprecated constants

I guess you could say this is my first issue with Discourse. I tried to update to 1.9.0.beta17, When I try to run the ./launcher rebuild app it starts out fine and then after a few short moments I get hit with this error

FAILED
Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’ failed with return #<Process::Status: pid 397 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn’
exec failed with the params {“cd”=>"$home", “hook”=>“bundle_exec”, “cmd”=>[“su discourse -c ‘bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4’”, “su discourse -c ‘bundle exec rake db:migrate’”, “su discourse -c ‘bundle exec rake assets:precompile’”]}
fc82dcd39523e668bcf12f479d2c4d59b129217050feb34f59960d74f1794fb0
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

Any help would be nice.

Thanks :slight_smile:

Can you share the rest of the logs? From the section you shared:

1 Like
2017-12-21 20:20:12.295 UTC [450] discourse@discourse LOG: duration: 182.979 ms bind &lt;unnamed&gt;: SELECT COUNT(*) FROM (SELECT 1 FROM "users" LIMIT 20) subquery_for_count
rake aborted!
NameError: uninitialized constant USERNAME_ROUTE_FORMAT
/var/www/discourse/plugins/discourse-voting/plugin.rb:278:in `block (2 levels) in activate!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:426:in `instance_exec'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:426:in `eval_block'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:433:in `block in finalize!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:433:in `each'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:433:in `finalize!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:59:in `each'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:59:in `finalize!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:19:in `reload!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:41:in `block in updater'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/file_update_checker.rb:81:in `execute'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:42:in `updater'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:128:in `block in &lt;module:Finisher&gt;'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `public_send'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/railtie.rb:185:in `method_missing'
/var/www/discourse/config/environment.rb:5:in `&lt;top (required)&gt;'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rake-12.1.0/exe/rake:27:in `&lt;top (required)&gt;'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `&lt;main&gt;'
Tasks: TOP =&gt; db:migrate =&gt; environment
(See full trace by running task with --trace)
I, [2017-12-21T20:20:13.406715 #13] INFO -- : gem install omniauth-discord -v 0.1.5 -i /var/www/discourse/plugins/discourse-plugin-discord-auth/gems/2.4.2 --no-document --ignore-dependencies
Successfully installed omniauth-discord-0.1.5
1 gem installed

I, [2017-12-21T20:20:13.407307 #13] INFO -- : Terminating async processes
I, [2017-12-21T20:20:13.407382 #13] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 42
I, [2017-12-21T20:20:13.407459 #13] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 155
2017-12-21 20:20:13.407 UTC [42] LOG: received fast shutdown request
2017-12-21 20:20:13.407 UTC [42] LOG: aborting any active transactions
2017-12-21 20:20:13.408 UTC [49] LOG: autovacuum launcher shutting down
2017-12-21 20:20:13.410 UTC [46] LOG: shutting down
155:signal-handler (1513887613) Received SIGTERM scheduling shutdown...
2017-12-21 20:20:13.435 UTC [46] LOG: database system is shut down
155:M 21 Dec 20:20:13.474 # User requested shutdown...
155:M 21 Dec 20:20:13.475 * Saving the final RDB snapshot before exiting.
155:M 21 Dec 20:20:13.495 * DB saved on disk
155:M 21 Dec 20:20:13.495 # Redis is now ready to exit, bye bye...
1 Like

If I’m reading that backtrace correctly, the discourse-voting plugin needs to be updated to use the new dynamic RouteFormat support. We’ll get to it Real Soon Now.

3 Likes

Had the same issue with one of my plugins. A quick search of GitHub - discourse/all-the-plugins suggests that a couple of other plugins will also need updating in addition to the voting plugin:

and also dl-license-keys @joebuhlig

3 Likes

Sorry about this - I did not realize any plugins were using constants from our routes.rb file. I’ve added them back with a note about them being deprecated.

https://github.com/discourse/discourse/commit/d0b44520bd36e271e0b935a6bd11fc9dc66a19d5

In a plugin you can support both with a piece of code like this:

defined?(RouteFormat) ? RouteFormat.username : USERNAME_ROUTE_FORMAT
5 Likes

Also I have updated our official plugins using these constants with that suggestion :+1:

5 Likes

So, to close the loop on this, @LordAres you should be able to rebuild now without a problem. Sorry for the inconvenience.

2 Likes

Thank you! Rebuilding now, so far so good. :+1:

1 Like