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

Error after upgrading to 3.0 #19

Closed
archonic opened this issue Jun 3, 2020 · 7 comments · Fixed by #21
Closed

Error after upgrading to 3.0 #19

archonic opened this issue Jun 3, 2020 · 7 comments · Fixed by #21
Assignees
Labels

Comments

@archonic
Copy link

archonic commented Jun 3, 2020

I've tried upgrading to 3.0 but I'm getting the following backtrace:

ArgumentError: wrong number of arguments (given 2, expected 1)
/usr/local/bundle/gems/simple-feed-3.0.0/lib/simplefeed/providers/proxy.rb:32:in `method_missing'
/usr/local/bundle/gems/simple-feed-3.0.0/lib/simplefeed/feed.rb:38:in `provider='
/app/config/initializers/simple_feed.rb:6:in `block in <main>'

Here's my simple_feed.rb initializer

require "simplefeed"

SIMPLEFEED_URL = "#{ENV['REDIS_BASE_URL']}/1/simplefeed"
SIMPLEFEED_ENV_PREFIX = !Rails.env.production? ? Rails.env.first : ""
SimpleFeed.define(:accounts) do |f|
  f.provider = SimpleFeed.provider(
    :redis,
    redis: -> { ::Redis.new(url: SIMPLEFEED_URL) },
    pool_size: 10
  )
  f.per_page   = 25  # default page size
  f.batch_size = 10  # default batch size
  f.namespace  = "#{SIMPLEFEED_ENV_PREFIX}a"
end

Is there an undocumented change to what provider accepts?

Update:
The same backtrace happens when using f.provider = SimpleFeed.provider(:hash). Seems 3.0 is broken all on it's own? Not sure how tests are passing if that were the case.

@archonic
Copy link
Author

archonic commented Jun 3, 2020

Simple-feed 3.0 is broken out the box. I checked out the gem at 3.0 and tried running the redis example.

ruby examples/redis_provider_example.rb
Traceback (most recent call last):
	8: from examples/redis_provider_example.rb:21:in `<main>'
	7: from /Users/user/code/simple-feed/lib/simplefeed.rb:34:in `define'
	6: from /Users/user/code/simple-feed/lib/simplefeed.rb:34:in `tap'
	5: from /Users/user/code/simple-feed/lib/simplefeed.rb:35:in `block in define'
	4: from /Users/user/code/simple-feed/lib/simplefeed/feed.rb:70:in `configure'
	3: from /Users/user/code/simple-feed/lib/simplefeed.rb:36:in `block (2 levels) in define'
	2: from examples/redis_provider_example.rb:22:in `block in <main>'
	1: from /Users/user/code/simple-feed/lib/simplefeed/feed.rb:38:in `provider='
/Users/user/code/simple-feed/lib/simplefeed/providers/proxy.rb:32:in `method_missing': wrong number of arguments (given 2, expected 1) (ArgumentError)

Side note, the dependencies listed in that file are incomplete. The full list is gem install colored2 awesome_print base62-rb redis hiredis.

Update: I'm getting the same behaviour with 2.1.0. Backdating to 2.0.2 works.

@kigster kigster self-assigned this Jun 16, 2020
@kigster kigster added the broke label Jun 16, 2020
@kigster
Copy link
Owner

kigster commented Jun 16, 2020

@archonic Thank you for reporting, and sorry about the breakage. Looking at in right now.

@kigster
Copy link
Owner

kigster commented Jun 16, 2020

@archonic What version of Ruby are you using?

Would you mind running gem environment in the simple feed root folder and pasting the output here?

I am unable to reproduce this issue on 2.7.1, and the tests are passing on:

- 2.3.8
- 2.4.10
- 2.5.3
- 2.6.2
- 2.7.1

The tests most definitely call .provider= many times.

@kigster kigster added the unable-to-reproduce But requires additional information label Jun 16, 2020
@kigster
Copy link
Owner

kigster commented Jun 17, 2020

Yeah, I can't really reproduce this at all. Not sure what's going on, but please provide your Ruby environment.

@kigster kigster removed the broke label Jun 17, 2020
@mizoR
Copy link
Contributor

mizoR commented Jun 17, 2020

I got same error in my Rails app too. Ruby version is 2.6.6 and gem environment is:

bash-5.0# gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.3
  - RUBY VERSION: 2.6.6 (2020-03-31 patchlevel 146) [x86_64-linux-musl]
  - INSTALLATION DIRECTORY: /usr/local/bundle
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bundle/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/bundle
     - /root/.gem/ruby/2.6.0
     - /usr/local/lib/ruby/gems/2.6.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--no-document"
     - "update" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bundle/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin

@kigster kigster linked a pull request Jun 17, 2020 that will close this issue
@kigster
Copy link
Owner

kigster commented Jun 17, 2020

@archonic Thanks so much!

Looks like a Travis issue — tests are definitely breaking on 2.6 locally, but passing on Travis. Anyway, fix is on its way. Going to push 3.0.1 and yank 3.0.0.

The reason for this issue if me updating method_missing to be compatible with future Ruby versions (which will require *args, **opts for all methods), but it's breaking the older Rubies it would seem.

@kigster kigster added broke and removed unable-to-reproduce But requires additional information labels Jun 17, 2020
@kigster
Copy link
Owner

kigster commented Jun 17, 2020

Please install 3.0.1 and let me know if you have any issues.

Thanks again!

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

Successfully merging a pull request may close this issue.

3 participants