Mastodon: Error when running development environment: uninitialized constant ActiveRecordQueryTrace (NameError)

Created on 22 Apr 2017  ·  5Comments  ·  Source: tootsuite/mastodon

I'm trying to run mastodon in development mode, following Running-Mastodon/Development-guide.md.

But I'm hitting the same error as #749 and #1963 (see full error log below). The difference is that they ran the development environment accidentally, while I do actually want to run the development environment.

Regarding installation, this is Debian stretch with ruby 2.3.3 from the Debian packages, using mastodon v1.2.2. I basically cloned the VM I am running for a production instance, so it is running fine in production.

$ RAILS_ENV=development bundle exec rails db:setup
Database 'mastodon_development' already exists
Database 'mastodon_test' already exists
**************************************************
⛔️ WARNING: Sidekiq testing API enabled, but this is not the test environment.  Your jobs will not go to Redis.
**************************************************
rails aborted!
NameError: uninitialized constant ActiveRecordQueryTrace
/home/mastodon/live/config/environments/development.rb:85:in `<top (required)>'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine.rb:599:in `each'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine.rb:599:in `block in <class:Engine>'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:44:in `each'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
/home/mastodon/live/config/environment.rb:5:in `<top (required)>'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:328:in `require_environment!'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:448:in `block in run_tasks_blocks'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:setup => db:schema:load_if_ruby => environment
(See full trace by running task with --trace)

Here is the error log when running rails:

$ bundle exec rails server
=> Booting Puma
=> Rails 5.0.2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
**************************************************
⛔️ WARNING: Sidekiq testing API enabled, but this is not the test environment.  Your jobs will not go to Redis.
**************************************************
Exiting
/home/mastodon/live/config/environments/development.rb:85:in `<top (required)>': uninitialized constant ActiveRecordQueryTrace (NameError)
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine.rb:599:in `each'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/engine.rb:599:in `block in <class:Engine>'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
    from /usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /usr/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from /usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /usr/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:44:in `each'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /usr/lib/ruby/2.3.0/tsort.rb:415:in `call'
    from /usr/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from /usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
    from /usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
    from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
    from /usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
    from /usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
    from /home/mastodon/live/config/environment.rb:5:in `<top (required)>'
    from /home/mastodon/live/config.ru:4:in `block in <main>'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
    from /home/mastodon/live/config.ru:in `new'
    from /home/mastodon/live/config.ru:in `<main>'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/server.rb:59:in `app'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/server.rb:124:in `log_to_stdout'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/server.rb:77:in `start'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in server'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /home/mastodon/live/vendor/bundle/ruby/2.3.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

  • [X] I searched or browsed the repo’s other issues to ensure this is not a duplicate.
  • [X] This bug happens on a tagged release and not on master (If you're a user, don't worry about this).
bug

Most helpful comment

Solved by installing the development dependencies:

bundle install --deployment --with development

Bundle is not intuitive, I thought that by simply omitting --without development it would install development gems, but apparently not.

I'm leaving this ticket open until the doc is fixed (by me or somebody else).

All 5 comments

Solved by installing the development dependencies:

bundle install --deployment --with development

Bundle is not intuitive, I thought that by simply omitting --without development it would install development gems, but apparently not.

I'm leaving this ticket open until the doc is fixed (by me or somebody else).

I'm glad you got it figured out! Yeah, Bundler can be a bit unintuitive for sure. A pull request to the docs repo would be welcome :bow:

FYI, the merge of PR tootsuite/documentation#244 removed the introduced flag, but it seems to be needed still?

--deployment means "without development" FYI

If you're installing freshly for development, simply run bundle install without flags. If installing for production, use --deployment, but then you don't need development.

Mind that bundler remembers your settings so then you can just run bundle and it updates with the same settings.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lewiscowles1986 picture Lewiscowles1986  ·  3Comments

psychicteeth picture psychicteeth  ·  3Comments

KellerFuchs picture KellerFuchs  ·  3Comments

almafeta picture almafeta  ·  3Comments

selfagency picture selfagency  ·  3Comments