Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with Rails 7 #180

Closed
scott-knight opened this issue Dec 24, 2021 · 17 comments · Fixed by #191
Closed

Incompatible with Rails 7 #180

scott-knight opened this issue Dec 24, 2021 · 17 comments · Fixed by #191

Comments

@scott-knight
Copy link

scott-knight commented Dec 24, 2021

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.

@viktorianer
Copy link

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.

@cmer
Copy link

cmer commented Jan 15, 2022

If it helps, I was able to get past the stack overflow error like this: rails/rails#44157 (comment)

But then my code crashes later on.

@xanderificnl
Copy link

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

Please advise.

@mwenger1
Copy link

Also encountering same issues.

@Alien0417
Copy link

same issues

@gsanchezd
Copy link

Same issue with ruby 3.1.2p20 and Rails 7.0.3

leoarnold added a commit to leoarnold/rails_panel that referenced this issue Jan 2, 2023
leoarnold added a commit to leoarnold/rails_panel that referenced this issue Jan 2, 2023
leoarnold added a commit to leoarnold/rails_panel that referenced this issue Jan 2, 2023
@amrdruid
Copy link

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

@elalemanyo
Copy link

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

@amrdruid
Copy link

@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
Copy link

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

@DmitrySychev
Copy link

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'

JuanVqz added a commit to JuanVqz/rails_panel that referenced this issue Oct 6, 2023
The railties dependency was blocking compatibility with a new version,
after allowing it should be fine.

Fixes dejan#180
@elalemanyo
Copy link

@DmitrySychev Did you ever find a solution?

@DmitrySychev
Copy link

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

@scott-knight
Copy link
Author

@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.

@leoplct
Copy link

leoplct commented Nov 9, 2023

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?

@elalemanyo
Copy link

elalemanyo commented Nov 9, 2023

@leoplct there are several pull requests solving this, for example #192

@scott-knight
Copy link
Author

scott-knight commented Nov 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.