Question

bundle install NoMethodError: undefined method `gsub' for nil:NilClass

Posted August 4, 2020 632 views
Ruby on RailsDigitalOcean

During a routine deploy (a log message was being changed) to one of our testing environment servers, the deploy failed with the message NoMethodError: undefined methodgsub’ for nil:NilClasswhenbundle install` was run.

On testing the failing command, it also failed with the same message and backtrace when run manually on the server. It failed in the same way when run on one of our other testing servers.

It did NOT fail when run on staging. (Our testing servers are on DigitalOcean, with staging and production on AWS).

We have not changed any firewall settings recently on DigitalOcean.

Here is the error log:


2020-08-04 16:29:33
ffe-deploy
00:02 bundler:install
      01 RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.2 $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deployer/------/shared/bundle --without development test --deployment --quiet
2020-08-04 16:29:34
ffe-deploy
      01 --- ERROR REPORT TEMPLATE -------------------------------------------------------
      01 - What did you do?
      01 
      01   I ran the command `/home/deployer/.rbenv/versions/2.3.2/bin/bundle install --path /home/deployer/------/shared/bundle --without development test --deployment --quiet`
      01 
      01 - What did you expect to happen?
      01 
      01   I expected Bundler to...
2020-08-04 16:29:34
ffe-deploy
      01 
      01 - What happened instead?
      01 
      01   Instead, what happened was...
      01 
      01 
      01 Error details
      01 
      01     NoMethodError: undefined method `gsub' for nil:NilClass
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:53:in `block in update'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29:in `update'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:65:in `update'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:56:in `update_and_parse_checksums!'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher/compact_index.rb:67:in `available?'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher/compact_index.rb:15:in `call'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher/compact_index.rb:15:in `block in compact_index_request'
2020-08-04 16:29:34
ffe-deploy
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/fetcher.rb:157:in `use_api'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:332:in `block in api_fetchers'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:332:in `select'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:332:in `api_fetchers'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:337:in `block in remote_specs'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/index.rb:10:in `build'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:336:in `remote_specs'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/source/rubygems.rb:83:in `specs'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/lazy_specification.rb:61:in `__materialize__'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/spec_set.rb:91:in `block in materialize'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/spec_set.rb:88:in `map!'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/spec_set.rb:88:in `materialize'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:174:in `specs'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:162:in `resolve_remotely!'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/installer.rb:225:in `resolve_if_need'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/installer.rb:78:in `run'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/installer.rb:24:in `install'
      01       /home/deployer/.rbenv/rbenv.d/exec/gem-rehash/rubygems_plugin.rb:27:in `install'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli/install.rb:71:in `run'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:189:in `install'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:20:in `dispatch'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/cli.rb:11:in `start'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:34:in `block in <top (required)>'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
      01       /home/deployer/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/exe/bundle:26:in `<top (required)>'
      01       /home/deployer/.rbenv/versions/2.3.2/bin/bundle:22:in `load'
      01       /home/deployer/.rbenv/versions/2.3.2/bin/bundle:22:in `<main>'
      01 
      01 Environment
      01       
2020-08-04 16:29:34
ffe-deploy
      01   Bundler   1.13.6
      01   Rubygems  2.5.2
      01   Ruby      2.3.2p217 (2016-11-15 revision 56796) [x86_64-linux]
      01   GEM_HOME  /home/deployer/------/shared/bundle/ruby/2.3.0
      01   GEM_PATH  
      01   Git       2.7.4
      01       
      01       Bundler settings
      01       
      01   git.allow_insecure
      01     Set for the current user (/home/deployer/.bundle/config): "true"
      01   path
      01     Set for your local app (/home/deployer/------/releases/20200804162931/.bundle/config): "/home/deployer/------/shared/bundle"
      01   disable_shared_gems
      01     Set for your local app (/home/deployer/------/releases/20200804162931/.bundle/config): true
      01   frozen
      01     Set for your local app (/home/deployer/------/releases/20200804162931/.bundle/config): "1"
      01   without
      01     Set for your local app (/home/deployer/------/releases/20200804162931/.bundle/config): "development:test"
      01   gems.contribsys.com
      01     Set via BUNDLE_GEMS__CONTRIBSYS__COM: ------
      01 --- TEMPLATE END ----------------------------------------------------------------
      01 
      01 Unfortunately, an unexpected error occurred, and Bundler cannot continue.
2020-08-04 16:29:34
ffe-deploy
      01 
      01 First, try this link to see if there are any existing issue reports for this error:
      01 https://github.com/bundler/bundler/search?q=undefined+method+%60gsub%27+for+nil+NilClass&type=Issues
      01 
      01 If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
      01 https://github.com/bundler/bundler/issues/new

https://github.com/rubygems/bundler/issues/5127 Seems to be a similar issue, but we haven’t made any changes to access settings.

Since the problem is only occurring on our DigitalOcean servers, it seems that there must be something about them specifically that is causing the problem. The last deploy to one of the affected servers was July 30 (5 days ago).

Any ideas?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

For anyone else encountering a similar problem, this was resolved by updating bundler version.

Submit an Answer