rails_panel icon indicating copy to clipboard operation
rails_panel copied to clipboard

Incompatible with Rails 7

Open scott-knight opened this issue 3 years ago • 6 comments

Using Rails 7 and Ruby 3.0.3, created a new Rails 7 full stack app, added meta_request to the Gemfile and ran bundler. Everything install as expected. Then tried to run rails db:create and received the following error:

rails aborted!
SystemStackError: stack level too deep
/Users/scottknight/scott.projects/jobsauce-app/.gems/gems/activesupport-7.0.0/lib/active_support/core_ext/object/json.rb:180:in 'initialize_dup'
/Users/scottknight/scott.projects/jobsauce-app/.gems/gems/activesupport-7.0.0/lib/active_support/core_ext/object/json.rb:180:in 'dup'
/Users/scottknight/scott.projects/jobsauce-app/.gems/gems/activesupport-7.0.0/lib/active_support/core_ext/object/json.rb:180:in 'block in as_json'
/Users/scottknight/scott.projects/jobsauce-app/.gems/gems/activesupport-7.0.0/lib/active_support/core_ext/object/json.rb:179:in 'each'
/Users/scottknight/scott.projects/jobsauce-app/.gems/gems/activesupport-7.0.0/lib/active_support/core_ext/object/json.rb:179:in 'as_json'
/Users/scottknight/scott.projects/jobsauce-app/.gems/gems/activesupport-7.0.0/lib/active_support/core_ext/object/json.rb:63:in 'as_json'

I commented out all gems in the Gemfile and enabled them one by one, each time running bundler then rails db:create until I received the same error. When meta_request was enabled, the error appeared again. When disabled (or removed), the error goes away. I have no idea why the gem would cause this error, but it is not compatible with Rails 7.

scott-knight avatar Dec 24 '21 04:12 scott-knight

And I can not install it on a new Rails 7 app?!

Bundler could not find compatible versions for gem "railties":
  In snapshot (Gemfile.lock):
    railties (= 7.0.0)

  In Gemfile:
    meta_request (~> 0.7.3) was resolved to 0.7.3, which depends on
      railties (>= 3.0.0, < 7)

    rails (~> 7.0.0) was resolved to 7.0.0, which depends on
      railties (= 7.0.0)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

viktorianer avatar Dec 24 '21 15:12 viktorianer

If it helps, I was able to get past the stack overflow error like this: https://github.com/rails/rails/issues/44157#issuecomment-1013607633

But then my code crashes later on.

cmer avatar Jan 15 '22 04:01 cmer

I'm also hitting the same errors w/ Rails 7.0.1.

Please advise.

xanderificnl avatar Jan 15 '22 10:01 xanderificnl

Also encountering same issues.

mwenger1 avatar Apr 23 '22 17:04 mwenger1

same issues

Alien0417 avatar Jul 31 '22 10:07 Alien0417

Same issue with ruby 3.1.2p20 and Rails 7.0.3

gsanchezd avatar Aug 29 '22 19:08 gsanchezd

It works if you set the gem's version to the master branch

amrdruid avatar Apr 26 '23 08:04 amrdruid

@amrdruid thank you very much, as you said it works like this: gem 'meta_request', github: 'dejan/rails_panel', branch: 'master'

elalemanyo avatar Apr 26 '23 09:04 elalemanyo

@elalemanyo Even better, you can use the version that is published in RubyGems

https://rubygems.org/gems/meta_request

gem 'meta_request', '~> 0.7.4'

amrdruid avatar Apr 26 '23 09:04 amrdruid

@scott-knight If this fixes it for you feel free to close this issue

amrdruid avatar Apr 26 '23 11:04 amrdruid

Issue is back with rails 7.1.0 beta, even while using meta_request 0.7.4

  /usr/local/bundle/gems/activesupport-7.1.0.beta1/lib/active_support/core_ext/object/json.rb:188:in `block in as_json'
  /usr/local/bundle/gems/activesupport-7.1.0.beta1/lib/active_support/core_ext/object/json.rb:187:in `each'
  /usr/local/bundle/gems/activesupport-7.1.0.beta1/lib/active_support/core_ext/object/json.rb:187:in `as_json'
  /usr/local/bundle/gems/activesupport-7.1.0.beta1/lib/active_support/core_ext/object/json.rb:63:in `as_json'
  /usr/local/bundle/gems/activesupport-7.1.0.beta1/lib/active_support/json/encoding.rb:39:in `encode'
  /usr/local/bundle/gems/activesupport-7.1.0.beta1/lib/active_support/json/encoding.rb:23:in `encode'
  /usr/local/bundle/gems/activesupport-7.1.0.beta1/lib/active_support/core_ext/object/json.rb:42:in `to_json'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:48:in `block in json_encodable'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:74:in `block in transform_hash'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:68:in `each'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:68:in `each_with_object'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:68:in `transform_hash'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:71:in `block (2 levels) in transform_hash'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:70:in `fetch'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:70:in `block in transform_hash'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:68:in `each'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:68:in `each_with_object'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:68:in `transform_hash'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:40:in `json_encodable'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/event.rb:16:in `initialize'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/app_notifications.rb:54:in `new'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/app_notifications.rb:54:in `block in <class:AppNotifications>'
  /usr/local/bundle/gems/meta_request-0.7.4/lib/meta_request/app_notifications.rb:82:in `block in subscribe'

DmitrySychev avatar Sep 15 '23 19:09 DmitrySychev

@DmitrySychev Did you ever find a solution?

elalemanyo avatar Nov 08 '23 17:11 elalemanyo

@elalemanyo, I haven’t, but I also haven’t actively looked into it. Had to stop using this gem and extension meanwhile.

DmitrySychev avatar Nov 08 '23 17:11 DmitrySychev

@DmitrySychev I also quit using the gem. @amrdruid I don't mind closing this bug if people feel that the fixes described above actually work. However, if there isn't an actual fix, code should be updated to fix this issue.

scott-knight avatar Nov 08 '23 18:11 scott-knight

On Rails 7.1.1 I got this error

Gemfile gem 'meta_request', github: 'dejan/rails_panel', branch: 'master'

ruby -v ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]

bundle

Could not find compatible versions

Because every version of meta_request depends on railties >= 3.0.0, < 7.1 and rails >= 7.1.1 depends on railties = 7.1.1, every version of meta_request is incompatible with rails >= 7.1.1. So, because Gemfile depends on rails >= 7.1.1 and Gemfile depends on meta_request >= 0, version solving has failed.

I really like this gem to find N+1 queries. Any alternatives?

leoplct avatar Nov 09 '23 11:11 leoplct

@leoplct there are several pull requests solving this, for example https://github.com/dejan/rails_panel/pull/192

elalemanyo avatar Nov 09 '23 11:11 elalemanyo

A bug fix for this issue has not been posted by the maintainers for nearly 2 years. I reached my frustration cap with this over a year ago and have since removed the gem from all of my projects. I'm closing this bug since there's a PR that appears to fix this issue.

scott-knight avatar Nov 09 '23 20:11 scott-knight