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

The "Ruby version does not exist for this stack" warning doesn't explain sticky versions #1141

Open
edmorley opened this issue Mar 5, 2021 · 6 comments

Comments

@edmorley
Copy link
Member

edmorley commented Mar 5, 2021

In https://heroku.support/967916 after upgrading from Heroku-16 to Heroku-20, builds of an existing app started failing with:

-----> Building on the Heroku-20 stack
-----> Ruby app detected
-----> Installing bundler 1.17.3
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rack
       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.3.4.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.
       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.3.4.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.
 !
 !     The Ruby version you are trying to install does not exist on this stack.
 !     
 !     You are trying to install ruby-2.3.4 on heroku-20.
 !     
 !     Ruby ruby-2.3.4 is present on the following stacks:
 !     
 !     - cedar-14
 !     - heroku-16
 !     
 !     Heroku recommends you use the latest supported Ruby version listed here:
 !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
 !     
 !     For more information on syntax for declaring a Ruby version see:
 !     https://devcenter.heroku.com/articles/ruby-versions

In this case, the app didn't have a Ruby version defined in Gemfile.lock, so the 2.3.4 version wasn't something they'd specified, but due to the sticky versions feature.

Whilst the above error message does link to docs that say how to specify a version explicitly, it requires both reading those docs and a couple of mental leaps to understand that the issue may be due to no version being specified. What also added to the confusion in this case, was that their review apps did work, since they were starting with a clean cache so defaulted to newer Ruby.

As such it would be great to explicitly call out why 2.3.4 was used in this case.

For example during successful builds, this warning is shown:

-----> Detecting rake tasks

###### WARNING:
       You have not declared a Ruby version in your Gemfile.
   
       To declare a Ruby version add this line to your Gemfile:
     
       ```
       ruby "2.6.6"
       ```
       
       For more information see:
         https://devcenter.heroku.com/articles/ruby-versions

However the build doesn't get as far as showing that warning in the stack upgrade case.

(For what it's worth the Python buildpack currently has the same issue -- it uses sticky versioning but doesn't explain what happened when that version isn't found on the current stack)

cc @schneems

@florian2
Copy link

Is there a solution to this problem? I get a, well, similar error:

=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby.git
=====> Detected Framework: Ruby
-----> Installing bundler 1.17.3
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 5 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.9.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.
       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 5 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.6.9.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.

       !
       !     The Ruby version you are trying to install does not exist on this stack.
       !
       !     You are trying to install ruby-2.6.9 on heroku-18.
       !
       !     Ruby ruby-2.6.9 is present on the following stacks:
       !
       !     - heroku-18
       !     - heroku-20
       !
       !     Heroku recommends you use the latest supported Ruby version listed here:
       !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
       !
       !     For more information on syntax for declaring a Ruby version see:
       !     https://devcenter.heroku.com/articles/ruby-versions

ruby-2.6.9 is declared in .ruby-version and of course Gemfile and Gemfile.lock
This error message makes even less sense than yours @edmorley
does anybody has an idea on how to solve this?

@edmorley
Copy link
Member Author

@schneems This issue came up again recently on Slack. Do you know how much work it would be to improve the UX here? :-)

@edmorley
Copy link
Member Author

edmorley commented Jun 16, 2022

Another ticket today where this caused confusion: https://heroku.support/1124585

Edit: Though this case wasn't sticky versions, but suggests the overall error message could be clearer.

@schneems
Copy link
Contributor

Is there a solution to this problem? I get a, well, similar error:

That error looks like a temporary glitch in the network. When I try to manually download the binary from that URL it works for me. Just re-run it.

@pglombardo
Copy link

A user just reported this in an open source project with a Heroku deploy button. The app.json hasn't changed in 9 months.

I just reproduced it myself:

-----> Building on the Heroku-22 stack
-----> Determining which buildpack to use for this app
 !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
			Detected buildpacks: Ruby,Node.js
			See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Installing bundler 2.3.10
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.0.4.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.
       Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://heroku-buildpack-ruby.s3.us-east-1.amazonaws.com/heroku-22/ruby-3.0.4.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.
 !
 !     The Ruby version you are trying to install does not exist on this stack.
 !     
 !     You are trying to install ruby-3.0.4 on heroku-22.
 !     
 !     Ruby ruby-3.0.4 is present on the following stacks:
 !     
 !     - heroku-18
 !     - heroku-20
 !     
 !     Heroku recommends you use the latest supported Ruby version listed here:
 !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
 !     
 !     For more information on syntax for declaring a Ruby version see:
 !     https://devcenter.heroku.com/articles/ruby-versions
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

The app Gemfile specifies

ruby ENV['CUSTOM_RUBY_VERSION'] || '>=2.7.0'

@mayordwells
Copy link

I faced this issue as well, all I had to do was downgrade the stack from 22 to 20,
How to change stacks can be found in the documentation. - https://devcenter.heroku.com/articles/heroku-20-stack

heroku stack:set heroku-20

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

5 participants