Crash upon start with ASM
Expected behavior vs actual behavior
App has been running perfectly for some time on rails 5.0.1 with active_model_serializers (1.0.0.pre.dev)
Recently just updated to rails 5.0.6, updated all gems and now getting this crash upon start.
Environment
ActiveModelSerializers Version (commit ref if not on tag): active_model_serializers (1.0.0.pre.dev)
Output of ruby -e "puts RUBY_DESCRIPTION":
2.4.1-p111
OS Type & Version:
Integrated application and version (e.g., Rails, Grape, etc): rails 5.06
Backtrace
2017-09-22T18:44:16.962346+00:00 heroku[web.1]: Starting process with command bundle exec puma -C config/puma.rb
2017-09-22T18:44:20.768965+00:00 app[web.1]: [4] Puma starting in cluster mode...
2017-09-22T18:44:20.768979+00:00 app[web.1]: [4] * Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot
2017-09-22T18:44:20.768980+00:00 app[web.1]: [4] * Min threads: 5, max threads: 5
2017-09-22T18:44:20.768981+00:00 app[web.1]: [4] * Environment: production
2017-09-22T18:44:20.768986+00:00 app[web.1]: [4] * Process workers: 3
2017-09-22T18:44:20.768987+00:00 app[web.1]: [4] * Preloading application
2017-09-22T18:44:26.847152+00:00 app[web.1]: [4] ! Unable to load application: NameError: uninitialized constant ActiveModel::Serializer
2017-09-22T18:44:26.847308+00:00 app[web.1]: bundler: failed to load command: puma (/app/vendor/bundle/ruby/2.4.0/bin/puma)
2017-09-22T18:44:26.847430+00:00 app[web.1]: NameError: uninitialized constant ActiveModel::Serializer
2017-09-22T18:44:26.847431+00:00 app[web.1]: /app/app/serializers/appointment_prompt_serializer.rb:12:in <top (required)>'
2017-09-22T18:44:26.847433+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies/interlock.rb:12:in block in loading'
2017-09-22T18:44:26.847433+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.6/lib/active_support/concurrency/share_lock.rb:150:in exclusive'
2017-09-22T18:44:26.847434+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies/interlock.rb:11:in loading'
2017-09-22T18:44:26.847435+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/engine.rb:476:in block (2 levels) in eager_load!'
2017-09-22T18:44:26.847436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/engine.rb:475:in each'
2017-09-22T18:44:26.847437+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/engine.rb:475:in block in eager_load!'
2017-09-22T18:44:26.847438+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/engine.rb:473:in each'
2017-09-22T18:44:26.847439+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/engine.rb:473:in eager_load!'
2017-09-22T18:44:26.847439+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/engine.rb:354:in eager_load!'
2017-09-22T18:44:26.847440+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/application/finisher.rb:59:in each'
2017-09-22T18:44:26.847441+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/application/finisher.rb:59:in block in module:Finisher'
2017-09-22T18:44:26.847441+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in instance_exec'
2017-09-22T18:44:26.847442+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in run'
2017-09-22T18:44:26.847443+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:55:in block in run_initializers'
2017-09-22T18:44:26.847444+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:228:in block in tsort_each'
2017-09-22T18:44:26.847444+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
2017-09-22T18:44:26.847445+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:431:in each_strongly_connected_component_from'
2017-09-22T18:44:26.847446+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:349:in block in each_strongly_connected_component'
2017-09-22T18:44:26.847446+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in each'
2017-09-22T18:44:26.847447+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in call'
2017-09-22T18:44:26.847447+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:347:in each_strongly_connected_component'
2017-09-22T18:44:26.847448+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:226:in tsort_each'
2017-09-22T18:44:26.847449+00:00 app[web.1]: /app/vendor/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:205:in tsort_each'
2017-09-22T18:44:26.847449+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:54:in run_initializers'
2017-09-22T18:44:26.847450+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/railties-5.0.6/lib/rails/application.rb:352:in initialize!'
2017-09-22T18:44:26.847450+00:00 app[web.1]: /app/config/environment.rb:5:in <top (required)>'
2017-09-22T18:44:26.847451+00:00 app[web.1]: config.ru:3:in require'
2017-09-22T18:44:26.847452+00:00 app[web.1]: config.ru:3:in block in <main>'
2017-09-22T18:44:26.847453+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in instance_eval'
2017-09-22T18:44:26.847453+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in initialize'
2017-09-22T18:44:26.847454+00:00 app[web.1]: config.ru:in new'
2017-09-22T18:44:26.847454+00:00 app[web.1]: config.ru:in <main>'
2017-09-22T18:44:26.847455+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in eval'
2017-09-22T18:44:26.847456+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in new_from_string'
2017-09-22T18:44:26.847456+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in parse_file'
2017-09-22T18:44:26.847457+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/configuration.rb:314:in load_rackup'
2017-09-22T18:44:26.847457+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/configuration.rb:243:in app'
2017-09-22T18:44:26.847458+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/runner.rb:138:in load_and_bind'
2017-09-22T18:44:26.847458+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/cluster.rb:397:in run'
2017-09-22T18:44:26.847459+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/launcher.rb:183:in run'
2017-09-22T18:44:26.847460+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/lib/puma/cli.rb:77:in run'
2017-09-22T18:44:26.847460+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.10.0/bin/puma:10:in <top (required)>'
2017-09-22T18:44:26.847461+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/puma:23:in load'
2017-09-22T18:44:26.847461+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/puma:23:in `<top (required)>'
2017-09-22T18:44:27.073336+00:00 heroku[web.1]: State changed from starting to crashed
Additonal helpful information
(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)
I got the same issue. Rails 5.0.6 Using active_model_serializers 1.0.0.pre.dev from https://github.com/rails-api/active_model_serializers.git (at master@e8f3ec8)
And I can not generate serializer.
$ rails g serializer message
Running via Spring preloader in process 30786
Could not find generator 'serializer'. Maybe you meant 'helper', 'mailer' or 'erb:mailer'
Run rails generate --help for more options.
@grimmwerks
active_model_serializers (1.0.0.pre.dev) Unable to load application: NameError: uninitialized constant ActiveModel::Serializer
@forestwater
Using active_model_serializers 1.0.0.pre.dev master@e8f3ec8
There's no such release as 1.0.0.pre.dev. Seems like you're both installing from source and you recently updated AMS?
I'm guessing you mean to be using the 0-10-stable branch (instead of relying on releases)?
@bf4 In my Gemfile, I bundle the AMS using: gem "active_model_serializers", github: "rails-api/active_model_serializers"
Anyway, if I use gem 'active_model_serializers', '0.10.5', the issue gone.
@forestwater perfect. I suggest you avoid installing directly from github, unless you have a really good reason. And in that case, that reason should, IMHO, be in the Gemfile right above the gem line.