Search code examples
rubygemsgem-fury

Uploading packages to Gemfury using RubyGems CLI silently failing


I am trying to upload a package to Gemfury using RubyGems as described here. The command below is failing without error messages:

$ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende/
Pushing gem to https://push.fury.io/dlresende/...

$ echo $?
1

Enabling debug and backtrace reveals an error which doesn't seem related with the upload per se:

$ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende/ --debug --backtrace
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `Errno::EEXIST' at /Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/dlresende/.gem/specs/rubygems.org%443
Pushing gem to https://push.fury.io/dlresende/...

$ echo $?
1

Solution

  • It turns out it was an URL problem...

    Enabling verbose revealed an extra / in the URL, which seemed to be causing the issue:

    $ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende/ --debug --backtrace --verbose
    NOTE:  Debugging mode prints all exceptions even when rescued
    Exception `Errno::EEXIST' at /Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/dlresende/.gem/specs/rubygems.org%443
    GET https://rubygems.org/latest_specs.4.8.gz
    304 Not Modified
    Pushing gem to https://push.fury.io/dlresende/...
    POST https://push.fury.io/dlresende//api/v1/gems
    301 Moved Permanently
    
    $ echo $?
    1
    

    Using https://push.fury.io/dlresende instead of https://push.fury.io/dlresende/ (without the / in the end, as opposed to what is described in the docs) fixed the issue:

    $ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende --debug --backtrace --verbose
    NOTE:  Debugging mode prints all exceptions even when rescued
    Exception `Errno::EEXIST' at /Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/dlresende/.gem/specs/rubygems.org%443
    GET https://rubygems.org/latest_specs.4.8.gz
    304 Not Modified
    Pushing gem to https://push.fury.io/dlresende...
    POST https://push.fury.io/dlresende/api/v1/gems
    200 OK
    ~~> Processing package upload
        Uploading            ... ok
    $ echo $?
    0