`fetch': key not found: :path (KeyError)
joshmfrankel opened this issue ยท 8 comments
Describe the bug
Running Rails tests or server produces the following error fetch': key not found: :path (KeyError)
.
I'm using dry-rails
but the issue seems to stem from lib/dry/system.rb:23
(dry-system)
Backtrace
> bundle exec rails test
/usr/local/bundle/gems/dry-system-0.23.0/lib/dry/system.rb:23:in `fetch': key not found: :path (KeyError)
from /usr/local/bundle/gems/dry-system-0.23.0/lib/dry/system.rb:23:in `register_provider'
from /usr/local/bundle/gems/dry-rails-0.4.0/lib/dry/rails/components.rb:5:in `<top (required)>'
from /usr/local/bundle/gems/dry-rails-0.4.0/lib/dry/rails.rb:5:in `require'
from /usr/local/bundle/gems/dry-rails-0.4.0/lib/dry/rails.rb:5:in `<top (required)>'
from /usr/local/bundle/gems/dry-rails-0.4.0/lib/dry-rails.rb:3:in `require'
from /usr/local/bundle/gems/dry-rails-0.4.0/lib/dry-rails.rb:3:in `<top (required)>'
from /usr/local/bundle/gems/bundler-2.3.5/lib/bundler/runtime.rb:60:in `require'
from /usr/local/bundle/gems/bundler-2.3.5/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
from /usr/local/bundle/gems/bundler-2.3.5/lib/bundler/runtime.rb:55:in `each'
from /usr/local/bundle/gems/bundler-2.3.5/lib/bundler/runtime.rb:55:in `block in require'
from /usr/local/bundle/gems/bundler-2.3.5/lib/bundler/runtime.rb:44:in `each'
from /usr/local/bundle/gems/bundler-2.3.5/lib/bundler/runtime.rb:44:in `require'
from /usr/local/bundle/gems/bundler-2.3.5/lib/bundler.rb:176:in `require'
from /app/config/application.rb:7:in `<top (required)>'
from /app/config/environment.rb:2:in `require_relative'
from /app/config/environment.rb:2:in `<top (required)>'
from /app/test/test_helper.rb:12:in `require_relative'
from /app/test/test_helper.rb:12:in `<top (required)>'
from /app/test/controllers/api/v1/some_controller_test.rb:2:in `require'
from /app/test/controllers/api/v1/some_controller_test.rb:2:in `<top (required)>'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/test_unit/runner.rb:47:in `require'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/test_unit/runner.rb:47:in `block in load_tests'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/test_unit/runner.rb:47:in `each'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/test_unit/runner.rb:47:in `load_tests'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/test_unit/runner.rb:40:in `run'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/commands/test/test_command.rb:33:in `perform'
from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/command/base.rb:87:in `perform'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/command.rb:48:in `invoke'
from /usr/local/bundle/gems/railties-7.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
ERROR: 1
To Reproduce
I'm using a super basic docker + rails repo and am able to recreate issue once I add gem 'dry-rails'
to the Gemfile. Rails server and testing stops working. See Repo here: https://github.com/joshmfrankel/rails-7-docker
Expected behavior
Expect tests and server to execute and dry-system to properly build
My environment
- Ubuntu 20.04.3
- Dry-rails - 0.4.0
- Ruby - 3.1.0
- Rails - 7.0.1
- Minitest 5.15.0
- Nodejs - 16.13.1
- Docker 20.10.12
- docker-compose 1.29.2
dry-system 0.23 had a lot of big changes. I'd recommend you pin to 0.22 within your app for now, it thank you for raising this issue here for us to fix.
@timriley Thank you for the speedy and efficient response. That solved it for me ๐ฏ. We've at least got a workaround now
gem "dry-rails", "~> 0.3"
gem "dry-system", "<= 0.22"
I'm gonna fix it and push a new release tomorrowish
OK I released 0.5.0