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

undefined method `find_and_load_provider' #1468

Closed
waghanza opened this issue Nov 3, 2024 · 3 comments
Closed

undefined method `find_and_load_provider' #1468

waghanza opened this issue Nov 3, 2024 · 3 comments
Assignees

Comments

@waghanza
Copy link

waghanza commented Nov 3, 2024

Hi,

When launching https://github.com/the-benchmarker/web-frameworks/blob/96f3a00ebee476f04074e000cdc2232d42348bbd/ruby/hanami/config.ru#L3 with bundle exec puma, I have the following error :

Puma starting in single mode...
* Puma version: 6.4.3 (ruby 3.3.5-p100) ("The Eagle of Durango")
*  Min threads: 0
*  Max threads: 5
*  Environment: production
*          PID: 9
/usr/local/lib/ruby/3.3.0/json/generic_object.rb:2: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add ostruct to your Gemfile or gemspec to silence this warning.
! Unable to load application: NoMethodError: undefined method `find_and_load_provider' for an instance of Dry::System::ProviderRegistrar
bundler: failed to load command: puma (/usr/local/bundle/bin/puma)
/usr/local/bundle/gems/hanami-2.1.1/lib/hanami/app.rb:155:in `prepare_app_providers': undefined method `find_and_load_provider' for an instance of Dry::System::ProviderRegistrar (NoMethodError)

        unless container.providers.find_and_load_provider(:logger)
                                  ^^^^^^^^^^^^^^^^^^^^^^^
        from /usr/local/bundle/gems/hanami-2.1.1/lib/hanami/app.rb:113:in `prepare_all'
        from /usr/local/bundle/gems/hanami-2.1.1/lib/hanami/slice.rb:774:in `prepare_slice'
        from /usr/local/bundle/gems/hanami-2.1.1/lib/hanami/slice.rb:254:in `prepare'
        from /usr/local/bundle/gems/hanami-2.1.1/lib/hanami/slice.rb:308:in `boot'
        from /usr/local/bundle/gems/hanami-2.1.1/lib/hanami.rb:211:in `boot'
        from /usr/local/bundle/gems/hanami-2.1.1/lib/hanami/boot.rb:5:in `<top (required)>'
        from /usr/local/lib/ruby/3.3.0/bundled_gems.rb:75:in `require'
        from /usr/local/lib/ruby/3.3.0/bundled_gems.rb:75:in `block (2 levels) in replace_require'
        from config.ru:1:in `block in <main>'
        from /usr/local/bundle/gems/rack-2.2.10/lib/rack/builder.rb:116:in `eval'
        from /usr/local/bundle/gems/rack-2.2.10/lib/rack/builder.rb:116:in `new_from_string'
        from /usr/local/bundle/gems/rack-2.2.10/lib/rack/builder.rb:105:in `load_file'
        from /usr/local/bundle/gems/rack-2.2.10/lib/rack/builder.rb:66:in `parse_file'
        from /usr/local/bundle/gems/puma-6.4.3/lib/puma/configuration.rb:368:in `load_rackup'
        from /usr/local/bundle/gems/puma-6.4.3/lib/puma/configuration.rb:290:in `app'
        from /usr/local/bundle/gems/puma-6.4.3/lib/puma/runner.rb:162:in `load_and_bind'
        from /usr/local/bundle/gems/puma-6.4.3/lib/puma/single.rb:44:in `run'
        from /usr/local/bundle/gems/puma-6.4.3/lib/puma/launcher.rb:194:in `run'
        from /usr/local/bundle/gems/puma-6.4.3/lib/puma/cli.rb:75:in `run'
        from /usr/local/bundle/gems/puma-6.4.3/bin/puma:10:in `<top (required)>'
        from /usr/local/bundle/bin/puma:25:in `load'
        from /usr/local/bundle/bin/puma:25:in `<top (required)>'
        from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `load'
        from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `kernel_load'
        from /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:23:in `run'
        from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:455:in `exec'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
        from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:35:in `dispatch'
        from /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
        from /usr/local/lib/ruby/3.3.0/bundler/cli.rb:29:in `start'
        from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.16/exe/bundle:28:in `block in <top (required)>'
        from /usr/local/lib/ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.16/exe/bundle:20:in `<top (required)>'
        from /usr/local/bin/bundle:25:in `load'
        from /usr/local/bin/bundle:25:in `<main>'

Any idea ?

@timriley
Copy link
Member

timriley commented Nov 3, 2024

Thanks for the report, @waghanza. This is a breakage I inadvertently introduced with the release of dry-system 1.1.0. Sorry about that.

I'll fix it in a patch release of dry-system soon. In the meantime, if you want the code above to work, force a "= 1.0.1" version (or similar) of dry-system in your Gemfile.

@timriley timriley moved this to Todo in Hanami 2.2 Nov 3, 2024
@timriley timriley self-assigned this Nov 3, 2024
@timriley
Copy link
Member

timriley commented Nov 3, 2024

Fixed in dry-rb/dry-system#277 and released as dry-system v1.1.1: https://github.com/dry-rb/dry-system/releases/tag/v1.1.1

@timriley timriley closed this as completed Nov 3, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Hanami 2.2 Nov 3, 2024
@timriley
Copy link
Member

timriley commented Nov 3, 2024

@waghanza if you could remove any version constraints on dry-system, do a bundle update and then test your Hanami app again, everything should work again. Please let me know if you have any further trouble 😄

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

No branches or pull requests

2 participants