uploadcare / uploadcare-ruby

Ruby API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
https://uploadcare.com
MIT License
39 stars 28 forks source link

Installation / usage guide no longer works #111

Closed jackc closed 1 year ago

jackc commented 1 year ago

Describe the bug

  1. Create a new directory
  2. $ bundle init
  3. Add gem "uploadcare-ruby" to Gemfile
  4. $ bundle install
  5. Try to require uploadcare

Expected behavior

It doesn't crash.

Code / screenshots

Gemfile:

source "https://rubygems.org"

gem "uploadcare-ruby"

main.rb:

require 'uploadcare'

Output from bundle exec ruby main.rb:

/Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/dry-configurable-0.16.0/lib/dry/configurable/dsl.rb:31:in `setting': wrong number of arguments (given 2, expected 1) (ArgumentError)
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/dry-configurable-0.16.0/lib/dry/configurable/class_methods.rb:44:in `setting'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/api_struct-1.0.5/lib/api_struct/settings.rb:5:in `<class:Settings>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/api_struct-1.0.5/lib/api_struct/settings.rb:2:in `<module:ApiStruct>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/api_struct-1.0.5/lib/api_struct/settings.rb:1:in `<top (required)>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/api_struct-1.0.5/lib/api_struct.rb:9:in `require_relative'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/api_struct-1.0.5/lib/api_struct.rb:9:in `<top (required)>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/client/rest_client.rb:4:in `require'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/client/rest_client.rb:4:in `<top (required)>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/client/conversion/base_conversion_client.rb:3:in `require_relative'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/client/conversion/base_conversion_client.rb:3:in `<top (required)>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/entity/entity.rb:3:in `require'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/entity/entity.rb:3:in `block in <top (required)>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/entity/entity.rb:3:in `each'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare/entity/entity.rb:3:in `<top (required)>'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare.rb:11:in `require'
    from /Users/jack/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/uploadcare-ruby-3.3.2/lib/uploadcare.rb:11:in `<top (required)>'
    from main.rb:1:in `require'
    from main.rb:1:in `<main>'

Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.8.1)
      public_suffix (>= 2.0.2, < 6.0)
    api_struct (1.0.5)
      dry-configurable
      dry-inflector
      dry-monads (~> 1)
      hashie
      http
    concurrent-ruby (1.1.10)
    domain_name (0.5.20190701)
      unf (>= 0.0.5, < 1.0.0)
    dry-configurable (0.16.0)
      dry-core (~> 0.6)
      zeitwerk (~> 2.6)
    dry-core (0.8.1)
      concurrent-ruby (~> 1.0)
    dry-inflector (0.3.0)
    dry-monads (1.4.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.7)
    ffi (1.15.5)
    ffi-compiler (1.0.1)
      ffi (>= 1.0.0)
      rake
    hashie (5.0.0)
    http (5.1.0)
      addressable (~> 2.8)
      http-cookie (~> 1.0)
      http-form_data (~> 2.2)
      llhttp-ffi (~> 0.4.0)
    http-cookie (1.0.5)
      domain_name (~> 0.5)
    http-form_data (2.3.0)
    llhttp-ffi (0.4.0)
      ffi-compiler (~> 1.0)
      rake (~> 13.0)
    parallel (1.22.1)
    public_suffix (5.0.0)
    rake (13.0.6)
    retries (0.0.5)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.8.2)
    uploadcare-ruby (3.3.2)
      api_struct (~> 1.0.1)
      dry-configurable (~> 0.9)
      parallel
      retries
    zeitwerk (2.6.1)

PLATFORMS
  x86_64-darwin-21

DEPENDENCIES
  uploadcare-ruby

BUNDLED WITH
   2.3.22
rsedykh commented 1 year ago

Hi @jackc. Sorry for the very late response, but have you tried https://github.com/uploadcare/uploadcare-ruby/releases/tag/v4.0.0-rc, does it work for you? It's not yet finished (we have to deal with https://github.com/uploadcare/uploadcare-rails/issues/110), so it's not yet on RubyGems, but as I understand it should work for you.

jackc commented 1 year ago

I haven't tried that. Memory is a bit fuzzy at this point. I think I actually ran into this when trying to upgrade a production app. When that failed I tried the installation guide on a fresh project to try to reproduce the problem -- that resulted in this post.

I think my attempt predated the instructions to lock the version of dry-configurable. That allowed me to move forward on production.

kraft001 commented 1 year ago

@jackc The issue was fixed in the latest version (4.3) No need to lock dry-configurable anymore

jackc commented 1 year ago

Thanks!