10

I just updated few gems, but when I pushed to heroku, the old ones are still copied in vendor/bundler and I have a message

Using bson (1.8.2)
[...]
Would have removed bson (1.5.2)

and indeed, in vendor/bundler the old gems is still copied.

However, if I create a new cedar application and I push to Heroku from scratch, the old gem is not copied in vendor/bundle and it works as expected.

The old gem version is neither in Gemfile nor Gemfile.lock, so I do not understand where the heroku bundler is getting this (outdated) information.

Any hints? thanks, Marco

  • I found what causes this.. see here http://stackoverflow.com/questions/14539894/would-have-removed-in-heroku-deploy-log/14826592#14826592 – Nick Ginanto Feb 12 '13 at 10:05

3 Answers3

3

That's a bug in Heroku deployment configuration. It writes a file .bundle/config which has a line:

BUNDLE_DRY_RUN: false

When bundler loads this global config file, it translates this to :dry_run => "false" When it checks for this setting, it's checking settings[:dry_run], which is a string, which evaluates to true.

Thanks to @Roman for the answer in a similar thread

My solution was (as I have a custom buildpack) to patch it

https://github.com/heroku/heroku-buildpack-ruby/blob/master/lib/language_pack/ruby.rb

line 408-409 from

    puts "Cleaning up the bundler cache."
    pipe "bundle clean"

to

    puts "Cleaning up the bundler cache."
    pipe "bundle config --delete dry_run"
    pipe "bundle clean"

bundle config --delete remove the config (note the underscore) and, by default dry-run is false. as a results

      Removing bson_ext (1.8.2)
1

On your development instance you could try.

bundle update

See details Here

Then commit the changes to Git and then push your application up to Heroku.

If the problem is with only a single GEM then you could try forcing the version number in your Gemfile.

gem 'bson', '1.8.2'
Mark Stratmann
  • 1,612
  • 14
  • 21
  • 1
    that is what I have done, and my local instance is "clean". The issue is only on the live instance on Heroku –  Jan 27 '13 at 00:08
  • Are you certain that your gemlock file is included in your git repository? – Mark Stratmann Jan 27 '13 at 06:30
  • yes. Otherwise Heroku will not compile –  Jan 27 '13 at 08:53
  • Have altered my answer showing how you can force the gem version in the Gemfile – Mark Stratmann Jan 27 '13 at 11:37
  • I'm getting the same messages on gems I have removed from my gemfile. Maybe Heroku is just being "safe", keeping the old gems around for a period of time? It doesn't seem to affect the app. I know that rubygems.com had some issues recently https://docs.google.com/document/d/10tuM51VKRcSHJtUZotraMlrMHWK1uXs8qQ6Hmguyf1g/preview?sle=true#. – SteveO7 Jan 31 '13 at 18:04
  • Did quoting the version in the Gemfile solve the issue of Heroku using the wrong version? if so could you accept the answer. – Mark Stratmann Feb 01 '13 at 12:37
  • @MarkStratmann, no he didnot. I already force the version of all gems to avoid automatic update. It was due to one of my manual updates that the problem appeared –  Feb 02 '13 at 11:55
  • I'm suddenly seeing this in my deployment logs on Heroku as well. While 'heroku run bundle list' has the correct gems being used, 'heroku run gem list' does show odd results. – poetmountain Feb 04 '13 at 07:20
0

The "Would have removed..." message is likely from a debug message accidentally released with Bundler. They can safely be ignored, and shouldn't appear with the next release, if not already fixed.

catsby
  • 11,276
  • 3
  • 37
  • 37
  • it is a message from Bundler indeed. But the old gems (bson 1.5.2 in the example above) are still installed in my slug (increasing its size, even if by a little). –  Feb 12 '13 at 00:57