Webpacker: FrozenError: can't modify frozen Array when adding devServer middleware

Created on 14 Sep 2018  路  7Comments  路  Source: rails/webpacker

I have no idea why but somehow, in one of my projects, app.middleware.middlewares is frozen when Webpacker tries to insert its devServer middleware.

I've _"fixed"_ it by duping the array (see https://github.com/rails/webpacker/compare/master...mikker:frozen-middlewares).

I've tried disable some gems and the like but haven't been able to find the culprit yet.


Ruby: 2.5.1
Rails: 5.2.1
Webpacker: 3.5.5 and/or master

Most helpful comment

Sorry to bother you, RailsAdmin 1.4.2 is out with the fix for this:
https://github.com/sferik/rails_admin/commit/94928d1de7cf6fd01ee19ed7a94f17c91e19282d

All 7 comments

Hey @mikker

Are you eager loading code in development?

  # Do not eager load code on boot.
  config.eager_load = false

Nope, config.eager_load = false

@mikker Any chance you're using ActiveAdmin ~> 1.4.1? I've seen similar issues reported elsewhere with that being another common link. That release does some introspection in the app middleware that could be a root cause, though I wasn't able to reproduce the issue myself.

  • rails/rails#33745
  • sferik/rails_admin#3060
  • rossta/serviceworker-rails#59

I'm also seeing this with RailsAdmin 1.4.1 but not 1.4.0. It seems likely this commit (https://github.com/sferik/rails_admin/commit/59478af9a05c76bdfe35e94e63c60ba89c27a483) is responsible, but I can't for the life of me figure out why.

Sorry to bother you, RailsAdmin 1.4.2 is out with the fix for this:
https://github.com/sferik/rails_admin/commit/94928d1de7cf6fd01ee19ed7a94f17c91e19282d

Thanks, appreciate the update!

Still having the same issue:

Completed 500 Internal Server Error in 3765ms (ActiveRecord: 278.3ms)

FrozenError (can't modify frozen fatal):

rails_admin (1.4.2)
ruby 2.5.5
rails 5.2.2

Was this page helpful?
0 / 5 - 0 ratings