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

Bundler 2 fails on release command #856

Closed
matthewrudy opened this issue Feb 19, 2019 · 13 comments
Closed

Bundler 2 fails on release command #856

matthewrudy opened this issue Feb 19, 2019 · 13 comments

Comments

@matthewrudy
Copy link

matthewrudy commented Feb 19, 2019

This is a duplicate of a issue on the bundler fork of this buildpack.
rubygems#5

Now you've released buildpack v199
which included this attempt to fix the issue
#850

however, it seems to still be broken.

Symptom is:

  • build works fine with bundler 2
  • running the release command fails with You must use Bundler 2 or greater with this lockfile.

Steps to recreate:

cd /tmp
git clone https://github.com/matthewrudy/bundler2-heroku-example.git
cd bundler2-heroku-example
heroku create
git push heroku master

Here's a gist of the error in action
https://gist.github.com/matthewrudy/a12772acd14418d70fbc6271dcb7c8ef

@schneems
Copy link
Contributor

Thanks a ton for the repro instructions. Very thorough and they were very helpful. Sorry that you've hit this problem.

I took a look and it looks like the conflict is with the built-in bundler that comes with ruby 2.6.0. If you move to Ruby 2.5.3 then you can deploy just fine.

I'm looking into the root cause now. cc/ @hsbt

@schneems
Copy link
Contributor

For anyone else this is the full error on release:

remote: Bundler::LockfileError: You must use Bundler 2 or greater with this lockfile.
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/lockfile_parser.rb:95:in `initialize'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/definition.rb:83:in `new'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/definition.rb:83:in `initialize'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/dsl.rb:234:in `new'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/dsl.rb:234:in `to_definition'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/dsl.rb:13:in `evaluate'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/definition.rb:34:in `build'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler.rb:135:in `definition'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler.rb:101:in `setup'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/bundler/setup.rb:20:in `<top (required)>'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
remote:   /app/vendor/ruby-2.6.0/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
remote: bundler: failed to load command: rails (/app/vendor/bundle/ruby/2.6.0/bin/rails)

@schneems
Copy link
Contributor

Deleted my last comment because it was incorrect. It turns out that this is an issue with Ruby 2.6.0 and it has been resolved in 2.6.1. The fix is going to be to move to Ruby 2.6.1. I'll document this in our known issues https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues

Going to close this issue for now. Please upgrade to Ruby 2.6.1. Thanks again for opening the ticket!

@matthewrudy
Copy link
Author

Oh wow.
Thanks for resolving this @schneems.

Apologies if the 2.6.0 issue threw you off.
Will upgrade to 2.6.1.

Thanks again for your time and effort.

@schneems
Copy link
Contributor

Apologies if the 2.6.0 issue threw you off.

No apologies needed. It's good to have this documented. People will find this issue and also see our devcenter. I wasn't aware of the issue prior to you reporting it. Thanks for the excellent reproduction. It helped me zero in on the issue very fast. Have a great day!

@dentarg
Copy link

dentarg commented Feb 19, 2019

@schneems what was the issue with 2.6.0 that was fixed in 2.6.1? ruby/ruby@ad6e91d? couldn't spot anything about bundler at ruby/ruby@v2_6_0...v2_6_1

@schneems
Copy link
Contributor

I'm honestly not sure. This commit touches rubygems though, ruby/ruby@ad6e91d.

@schneems
Copy link
Contributor

For the sake of completeness, I wanted to mention that this third party "bundler 2" buildpack fails with Ruby 2.6.0 as well https://github.com/bundler/heroku-buildpack-bundler2

@greghuc
Copy link

greghuc commented Feb 21, 2019

Not sure use of bundler 2.0.1 with ruby 2.6.1 is working yet.

I've just deployed a pure ruby heroku app thats run as a scheduled job. Am seeing "You must use Bundler 2 or greater with this lockfile" when the scheduled job runs. Full stacktrace below. The job runs fine on my local dev box, as long as I run beforehand: "gem update --system --no-document"

From the deploy:

remote: -----> Using Ruby version: ruby-2.6.1�
remote: -----> Installing dependencies using bundler 2.0.1�
From the scheduled job:
2019-02-21T12:33:14.122910+00:00 app[scheduler.3928]: /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
2019-02-21T12:33:14.122934+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/lockfile_parser.rb:95:in `initialize'
2019-02-21T12:33:14.122936+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/definition.rb:83:in `new'
2019-02-21T12:33:14.122937+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/definition.rb:83:in `initialize'
2019-02-21T12:33:14.122938+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/dsl.rb:234:in `new'
2019-02-21T12:33:14.122940+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/dsl.rb:234:in `to_definition'
2019-02-21T12:33:14.122945+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/dsl.rb:13:in `evaluate'
2019-02-21T12:33:14.122947+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/definition.rb:34:in `build'
2019-02-21T12:33:14.122948+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler.rb:135:in `definition'
2019-02-21T12:33:14.122949+00:00 app[scheduler.3928]: from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler.rb:101:in `setup'
2019-02-21T12:33:14.122951+00:00 app[scheduler.3928]: from /app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/setup.rb:20:in `<top (required)>'
2019-02-21T12:33:14.122952+00:00 app[scheduler.3928]: from /app/vendor/ruby-2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2019-02-21T12:33:14.122954+00:00 app[scheduler.3928]: from /app/vendor/ruby-2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2019-02-21T12:33:14.122955+00:00 app[scheduler.3928]: from bin/healthcheck:14:in `<main>'

@schneems
Copy link
Contributor

schneems commented Feb 21, 2019

@greghuc please open a support ticket so I can take a look at your app. I can't do much without a reproduction.

The job runs fine on my local dev box, as long as I run beforehand: "gem update --system --no-document"

That sounds like a rubygems issue. We are pegged to the specific version of rubygems that ships with Ruby and Ruby 2.6.1 ships with rubygems 3.0.1. The latest release is 3.0.2. Likely when Ruby 2.6.2 ships it will get the latest rubygems version.

Either way i've had a number of people report that the specific error encountered on this issue is fixed when upgrading to Ruby 2.6.1, so what you're seeing is likely a different issue. Please open a support ticket, go to help.heroku.com search for "You must use Bundler 2 or greater with this lockfile" then open a ticket.

It's odd that the only the job task fails and nothing else, i'm guessing the issue is either due to use or lack of bundle exec or has something to do with a binstub. Either way, please open a ticket so I can investigate.

@greghuc
Copy link

greghuc commented Feb 21, 2019

@schneems ok, will open support ticket, but will be early next week.

@schneems
Copy link
Contributor

schneems commented Feb 25, 2019

Wanted to leave some more notes.

Failing in Release mode even with Ruby 2.6.1

If the build succeeds but release phase (or booting) fails the issue is that bundle exec is not being manually invoked and so when rubygems tries to load bundler it fails to find the most recent version for some reason and instead loads the version that ships with Ruby 2.6.1 which does not support Bundler 2.0.1 Gemfile.lock as mentioned in rubygems/rubygems#2592.

There's two ways to fix this.

  1. Make sure that all your commands have bundle exec on them
  2. This one is strange, but it works. Make sure all your binstubs in bin/ directory have this code before loading config/boot:
begin
  load File.expand_path('../spring', __FILE__)
rescue LoadError => e
  raise unless e.message.include?('spring')
end

Even when spring is not present on the system, this code does something that allows bundler to initialize correctly that doesn't happen when you comment this code out.

Ruby version in Path

If you're seeing 2.6.0 in your path but you've specified Ruby 2.6.1 this is completely expected. I.e. just because the error output looks like this does not mean that there was a problem in setting your Ruby version:

remote: /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/lockfile_parser.rb:95:in `initialize'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/definition.rb:83:in `new'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/definition.rb:83:in `initialize'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/dsl.rb:234:in `new'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/dsl.rb:234:in `to_definition'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/dsl.rb:13:in `evaluate'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler/definition.rb:34:in `build'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler.rb:135:in `definition'
remote: 	from /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.1/lib/bundler.rb:101:in `setup'
remote: 	from /app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/setup.rb:20:in `<top (required)>'
remote: 	from /app/vendor/ruby-2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
remote: 	from /app/vendor/ruby-2.6.1/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
remote: 	from /app/config/boot.rb:3:in `<top (required)>'
remote: 	from /app/bin/rake:2:in `require_relative'
remote: 	from /app/bin/rake:2:in `<main>'
remote: Waiting for release.... failed.

This output is due to legacy reasons. I've opened a ticket to track the possibility of changing the value #857.

@schneems
Copy link
Contributor

Reported the issue to Ruby core in https://bugs.ruby-lang.org/issues/15622

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

No branches or pull requests

4 participants