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

Conflicting class name with jsonapi-serializer gem #448

Open
gusverdywid opened this issue Apr 15, 2021 · 3 comments
Open

Conflicting class name with jsonapi-serializer gem #448

gusverdywid opened this issue Apr 15, 2021 · 3 comments

Comments

@gusverdywid
Copy link

Expected behavior

It plays well with any json serializer library. Mine is https://github.com/jsonapi-serializer/jsonapi-serializer

Actual behavior

It does not play well with jsonapi-serializer.

Failure Logs

TypeError:
  superclass mismatch for class Error
# ~/.gem/ruby/3.0.0/gems/jsonapi-serializer-2.2.0/lib/jsonapi/serializer/errors.rb:5:in `<module:Serializer>'
# ~/.gem/ruby/3.0.0/gems/jsonapi-serializer-2.2.0/lib/jsonapi/serializer/errors.rb:4:in `<module:JSONAPI>'
# ~/.gem/ruby/3.0.0/gems/jsonapi-serializer-2.2.0/lib/jsonapi/serializer/errors.rb:3:in `<top (required)>'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
# ~/.gem/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
# ~/.gem/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
# ~/.gem/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
# ~/.gem/ruby/3.0.0/gems/jsonapi-serializer-2.2.0/lib/fast_jsonapi.rb:3:in `<top (required)>'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
# ~/.gem/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
# ~/.gem/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
# ~/.gem/ruby/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
# ~/.gem/ruby/3.0.0/gems/jsonapi-serializer-2.2.0/lib/jsonapi/serializer.rb:1:in `<top (required)>'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
# ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
# ./config/application.rb:22:in `<top (required)>'
# ./config/environment.rb:4:in `require_relative'
# ./config/environment.rb:4:in `<top (required)>'
# ./spec/rails_helper.rb:33:in `require'
# ./spec/rails_helper.rb:33:in `<top (required)>'
# ------------------
# --- Caused by: ---
# LoadError:
#   cannot load such file -- jsonapi-serializer
#   ~/.gem/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require'

Context

It is a fresh install of rails and I use jsonapi-serializer (https://github.com/jsonapi-serializer/jsonapi-serializer) which was originally by Netflix.
After having a look deeper, I found out that one of the gem used by forest_liana (jsonapi-serializers / https://github.com/fotinakis/jsonapi-serializers) has a conflicting code with the code by jsonapi-serializer (without the S at the end). It seems the jsonapi-serializers does not the same module name as its library name hence the conflict. See below.

The Error module by the jsonapi-serializer

Screen Shot 2021-04-15 at 11 16 19 am

The Error module by the jsonapi-seraliazers

Screen Shot 2021-04-15 at 11 25 44 am

The jsonapi-serializers should have used a the same name with their library name or at least prefixed the module name

  • Package Version: 6.3.1
  • Rails Version: 6.1.1
  • Database Dialect: PostgreSQL
  • Database Version: 13.1
@arnaudbesnier
Copy link
Member

Hi @verdywid, Thanks for the report.
The team is currently trying to fix this specific painful conflict.

For your information, we have a similar topic opened in our Community forum:
https://community.forestadmin.com/t/error-just-after-installing-forest/1801/13

@sruchi123
Copy link

sruchi123 commented May 17, 2021

HI , can you fix this issue asap if possible.. i am also getting same issue.

@arnaudbesnier
Copy link
Member

Hi @sruchi123,
As explained in my previous message, our team is currently investigating and trying to patch the package to prevent this issue in the future.

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

No branches or pull requests

4 participants