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

uninitialized constant SolidusPaypalCommercePlatform::PaymentMethod (NameError) #4426

Closed
joyboy67 opened this issue Jun 15, 2022 · 9 comments

Comments

@joyboy67
Copy link

joyboy67 commented Jun 15, 2022

Hello I have an issue during the rails g solidus:install

$ rails g solidus:install      
/usr/local/lib/ruby/gems/3.1/gems/solidus_paypal_commerce_platform-0.3.2/lib/solidus_paypal_commerce_platform/engine.rb:18:in `block in <class:Engine>': uninitialized constant SolidusPaypalCommercePlatform::PaymentMethod (NameError)

      app.config.spree.payment_methods << SolidusPaypalCommercePlatform::PaymentMethod
                                                                       ^^^^^^^^^^^^^^^
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/initializable.rb:32:in `instance_exec'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/initializable.rb:32:in `run'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /usr/local/lib/ruby/3.1/tsort.rb:228:in `block in tsort_each'
	from /usr/local/lib/ruby/3.1/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/local/lib/ruby/3.1/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1/tsort.rb:347:in `each'
	from /usr/local/lib/ruby/3.1/tsort.rb:347:in `call'
	from /usr/local/lib/ruby/3.1/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/local/lib/ruby/3.1/tsort.rb:226:in `tsort_each'
	from /usr/local/lib/ruby/3.1/tsort.rb:205:in `tsort_each'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/initializable.rb:60:in `run_initializers'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/application.rb:372:in `initialize!'
	from /home/cloud/mr/config/environment.rb:5:in `<main>'
	from /usr/local/lib/ruby/gems/3.1/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/lib/ruby/gems/3.1/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/lib/ruby/gems/3.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
	from /usr/local/lib/ruby/gems/3.1/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/application.rb:348:in `require_environment!'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/command/actions.rb:28:in `require_environment!'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/commands/generate/generate_command.rb:21:in `perform'
	from /usr/local/lib/ruby/gems/3.1/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/gems/3.1/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/gems/3.1/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/command/base.rb:87:in `perform'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/command.rb:48:in `invoke'
	from /usr/local/lib/ruby/gems/3.1/gems/railties-7.0.3/lib/rails/commands.rb:18:in `<main>'
	from /usr/local/lib/ruby/gems/3.1/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /usr/local/lib/ruby/gems/3.1/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from bin/rails:4:in `<main>'

Solidus version : 3.2.0.alpha, branch: master
Rails version: 7.0.3
Ruby version: 3.1.2
OS: OpenBSD 7.1 x64

If someone have an idea :)

@waiting-for-dev
Copy link
Contributor

waiting-for-dev commented Jun 15, 2022

That error is fixed on solidus_paypal_commerce_platform v0.4, recently released. Try to update it on your application: bundle update --source solidus_paypal_commerce_platform

@joyboy67
Copy link
Author

joyboy67 commented Jun 15, 2022

Thank you @waiting-for-dev for your response :)

I tried to update with bundle update --source solidus_paypal_commerce_platform and bundle update solidus_paypal_commerce_platform --major

but I got Bundler attempted to update solidus_paypal_commerce_platform but its version stayed the same

My bundle info:

$ bundle info solidus_paypal_commerce_platform
  * solidus_paypal_commerce_platform (0.3.2)
	Summary: Integrate Solidus with Paypal Commerce Platform
	Homepage: https://github.com/solidusio-contrib/solidus_paypal_commerce_platform
	Source Code: https://github.com/solidusio-contrib/solidus_paypal_commerce_platform
	Changelog: https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/releases
	Path: /usr/local/lib/ruby/gems/3.1/gems/solidus_paypal_commerce_platform-0.3.2

When I do bundle after modify the Gemfile with gem "solidus_paypal_commerce_platform", "0.4.0" I got

Bundler found conflicting requirements for the Ruby version:
  In Gemfile:
    puma (~> 5.0) was resolved to 5.6.4, which depends on
      Ruby (>= 2.2)

    solidus was resolved to 3.2.0.alpha, which depends on
      Ruby (>= 2.5.0)

    rails (~> 7.0.3) was resolved to 7.0.3, which depends on
      Ruby (>= 2.7.0)

    haml (~> 5.2) was resolved to 5.2.2, which depends on
      Ruby (>= 2.0.0)

    bootsnap was resolved to 1.12.0, which depends on
      Ruby (>= 2.4.0)

    jbuilder was resolved to 2.11.5, which depends on
      Ruby (>= 2.2.2)

    redcarpet (~> 3.5) was resolved to 3.5.1, which depends on
      Ruby (>= 1.9.2)

    webdrivers was resolved to 5.0.0, which depends on
      Ruby (>= 2.6.0)

    solidus_auth_devise was resolved to 2.5.4, which depends on
      devise (~> 4.1) was resolved to 4.8.1, which depends on
        Ruby (>= 2.1.0)

    rails (~> 7.0.3) was resolved to 7.0.3, which depends on
      activesupport (= 7.0.3) was resolved to 7.0.3, which depends on
        minitest (>= 5.1) was resolved to 5.16.0, which depends on
          Ruby (>= 2.6, < 4.0)

    solidus was resolved to 3.2.0.alpha, which depends on
      solidus_core (= 3.2.0.alpha) was resolved to 3.2.0.alpha, which depends on
        sprockets-rails was resolved to 3.4.2, which depends on
          sprockets (>= 3.0.0) was resolved to 4.0.3, which depends on
            rack (> 1, < 3) was resolved to 2.2.3.1, which depends on
              Ruby (>= 2.3.0)

    rails (~> 7.0.3) was resolved to 7.0.3, which depends on
      activesupport (= 7.0.3) was resolved to 7.0.3, which depends on
        tzinfo (~> 2.0) was resolved to 2.0.4, which depends on
          Ruby (>= 1.9.3)

    solidus was resolved to 3.2.0.alpha, which depends on
      solidus_core (= 3.2.0.alpha) was resolved to 3.2.0.alpha, which depends on
        acts_as_list (< 2.0) was resolved to 1.0.4, which depends on
          Ruby (>= 2.4.7)

    solidus was resolved to 3.2.0.alpha, which depends on
      solidus_frontend (= 3.2.0.alpha) was resolved to 3.2.0.alpha, which depends on
        truncate_html (~> 0.9, >= 0.9.2) was resolved to 0.9.3, which depends on
          Ruby (>= 1.9)

    solidus_paypal_commerce_platform (= 0.4.0) was resolved to 0.4.0, which depends on
      Ruby (~> 2.5)

  Current Ruby version:
    Ruby (= 3.1.2)

@waiting-for-dev
Copy link
Contributor

Oh, I see. It's being resolved to v0.3.2 because you're using Ruby 3.1. v0.3.2 supported ruby 3, but it was reverted because of an incompatibility in a dependency (see solidusio/solidus_paypal_commerce_platform#145).

I'm sorry for that, it's a shame, but it needs to be fixed in paypal/paypalhttp_ruby#12. As a temporary fix, you can create your fork of paypalhttp_ruby with the suggested fix pointed in the referenced issue. I'll bring this up to the core team to investigate if there's something else we can do from our end.

@joyboy67
Copy link
Author

Ok ! Thank you very much @waiting-for-dev :)

@joyboy67
Copy link
Author

@waiting-for-dev Do you mean this patch paypal/paypalhttp_ruby@80b6ca4 ?

I applied this patch but I have the same issue

@waiting-for-dev
Copy link
Contributor

Well, that will make paypalhttp_ruby compatible with Ruby 3, but then we need to tell solidus_paypal_commerce_platform also. For that, we need to revert solidusio/solidus_paypal_commerce_platform@99cfaff. Could you do that in a temporary fork for now? We talked about it yesterday in the Core Team meeting and decided to speak with people in Paypal to check if we can speed up things. Sorry for the hassle.

@waiting-for-dev
Copy link
Contributor

Of course, you can also downgrade your ruby to 2.7 and have a more straightforward setup until all of this is fixed 🤷

@joyboy67
Copy link
Author

Ok, thank you for your help @waiting-for-dev :)

@waiting-for-dev
Copy link
Contributor

Closing, I'm afraid we're out of options for now. Please, see #4494.

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

No branches or pull requests

2 participants