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

dry-configurable v0.11.0 breaks this gem #21

Closed
nuqz opened this issue Feb 16, 2020 · 10 comments
Closed

dry-configurable v0.11.0 breaks this gem #21

nuqz opened this issue Feb 16, 2020 · 10 comments
Labels

Comments

@nuqz
Copy link

nuqz commented Feb 16, 2020

I apologize for the brevity, but my time is running out.

Expected behavior

No errors after bundle install and/or bundle update.

Actual behavior

~/ruby-2.6.5/gems/warden-jwt_auth-0.4.0/lib/warden/jwt_auth.rb:41:in `block in <module:JWTAuth>': undefined method `symbolize_keys' for Warden::JWTAuth:Module (NoMethodError)

Steps to Reproduce the Problem

  1. Update bundle with bundle update, ensure dry-configurable was updated to 0.11 (which actually satisfies ~> 0.8)
  2. Run your app like rails c
  3. Catch an error

Debugging information

  • Version of warden-jwt_auth in use - 0.4
@r6m
Copy link

r6m commented Feb 16, 2020

Hi @nuqz. Same problem here. Could you come up with a work around until the problem is fixed?

@Mansh05
Copy link

Mansh05 commented Feb 16, 2020

@rezam90 you can specify the gem dry-configurator as 0.9 in your gem file and it should start working.

@Eric-Guo
Copy link
Contributor

Break do to dry-configurable #78, seems def setting(key, value = Undefined, options = Undefined, &block) remove completely.

@atefth
Copy link

atefth commented Feb 19, 2020

@rezam90 you can specify the gem dry-configurator as 0.9 in your gem file and it should start working.

But @Mansh05, when can we get a complete proper fix!?

@atefth
Copy link

atefth commented Feb 19, 2020

@rezam90 you can specify the gem dry-configurator as 0.9 in your gem file and it should start working.

Also the gem is

dry-configurable

@brentkearney
Copy link

brentkearney commented Feb 19, 2020

dry-configurable got updated as a dependency after bundle update, and it broke warden-jwt_auth. My app starts up in development mode, but then when I try to login, I get:

ArgumentError in SessionsController#create
+mappings+ is not a setting name

## From dry-configurable (0.11.1) lib/dry/configurable/config.rb:36:in `[]':
## Extracted source  (around line #36):
# @return Config value
def [](name)
  raise ArgumentError, "+#{name}+ is not a setting name" unless _settings.key?(name)

  _settings[name].value
end

## From warden-jwt_auth (0.4.0) lib/warden/jwt_auth/hooks.rb:18:in `after_set_user':
## Extracted source  (around line #18):
# @see https://github.com/hassox/warden/wiki/Callbacks
def self.after_set_user(user, auth, opts)
  new.send(:prepare_token, user, auth, opts)
end

In production mode, it fails during startup when migrations attempt to run:

rails aborted!
NoMethodError: undefined method `map' for nil:NilClass
/usr/local/rvm/gems/ruby-2.6.3/gems/warden-jwt_auth-0.4.0/lib/warden/jwt_auth.rb:92:in `upcase_first_items'
/usr/local/rvm/gems/ruby-2.6.3/gems/warden-jwt_auth-0.4.0/lib/warden/jwt_auth.rb:53:in `block in <module:JWTAuth>'
/usr/local/rvm/gems/ruby-2.6.3/gems/dry-configurable-0.11.1/lib/dry/configurable/setting.rb:119:in `evaluate'
/usr/local/rvm/gems/ruby-2.6.3/gems/dry-configurable-0.11.1/lib/dry/configurable/setting.rb:70:in `value'
/usr/local/rvm/gems/ruby-2.6.3/gems/dry-configurable-0.11.1/lib/dry/configurable/config.rb:111:in `method_missing'
/usr/local/rvm/gems/ruby-2.6.3/gems/devise-jwt-0.6.0/lib/devise/jwt/railtie.rb:19:in `block (3 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.6.3/gems/dry-configurable-0.11.1/lib/dry/configurable/methods.rb:15:in `configure'
/usr/local/rvm/gems/ruby-2.6.3/gems/devise-jwt-0.6.0/lib/devise/jwt/railtie.rb:15:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.6.3/gems/activesupport-5.2.4.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'

As per Mansh05, specifying the lower version of dry-configurable in my Gemfile seems to work-around the problem.

gem 'dry-configurable', '~> 0.9.0'

brentkearney added a commit to brentkearney/workshops that referenced this issue Feb 19, 2020
* Allow declined participants to register/login
@linqueta
Copy link

linqueta commented Feb 20, 2020

I kept the version 0.11.1 but in devise settings I called the fields to evaluate eagerly before warden because after the version 0.9.0 the gem dry-configurable evaluates settings lazy.

# devise.rb
#...
config.jwt do |jwt|
    jwt.secret = ENV['DEVISE_SECRET_KEY']
    jwt.dispatch_requests = [
      ['POST', %r{^/login$}]
    ]
    jwt.dispatch_requests
    jwt.revocation_requests = [
      ['DELETE', %r{^/logout$}]
    ]
    jwt.revocation_requests
    jwt.expiration_time = 5.minutes.to_i
end

It's working as well!

@waiting-for-dev
Copy link
Owner

Hey folks, for now just lock dry-configurable version in your Gemfile. I'll fix it as soon as possible (PR's more than welcome!)

@waiting-for-dev
Copy link
Owner

Fixed. It was a regression in dry-configurable and it has been fixed there. I've released v0.4.1 of warden-jwt_auth depending on a version at least equal that the one containing the fix.

@waiting-for-dev
Copy link
Owner

As it's taking longer than expected to be fixed upstream in dry-configurable, I have released a new version 0.4.2 which locks itself dry-configurable version. This way, once it's updated there I'll just release a new version and it'll be transparent for the user.

alekseytols90 pushed a commit to alekseytols90/Rubycustomworks that referenced this issue Apr 3, 2020
* Allow declined participants to register/login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants