@kyanny's blog

My thoughts, my life. Views/opinions are my own.

Heroku upgrade stack: from heroku-18 to heroku-20

Ruby (Rack) アプリケーションで heroku-18 stack を使ってるやつがいた。heroku-18 は 2023 年に EOL を迎えるので重い腰を上げてアップグレードした。が、Heroku Dashboard からも CLI からも↓のようなエラーが出てアップグレードできない(heroku-20 まではアップグレードできた)。Gemfile にも Gemfile.lock にも Ruby のバージョンは書いてないのだが、古い Ruby バージョンを引き続き使おうとする。

❯ git push heroku master
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 1.90 KiB | 1.90 MiB/s, done.
Total 8 (delta 3), reused 6 (delta 1), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-22 stack
remote: -----> Using buildpack: heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 1.17.3
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rack
remote:        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-2.6.6.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.
remote:        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-2.6.6.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.
remote:
remote:  !
remote:  !     The Ruby version you are trying to install does not exist on this stack.
remote:  !
remote:  !     You are trying to install ruby-2.6.6 on heroku-22.
remote:  !
remote:  !     Ruby ruby-2.6.6 is present on the following stacks:
remote:  !
remote:  !     - heroku-18
remote:  !     - heroku-20
remote:  !
remote:  !     Heroku recommends you use the latest supported Ruby version listed here:
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !
remote:  !     For more information on syntax for declaring a Ruby version see:
remote:  !     https://devcenter.heroku.com/articles/ruby-versions
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 4ad79302da074ca241f589404dc06ea90e4c1500
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 4ad79302da074ca241f589404dc06ea90e4c1500
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: !   Push rejected to shibuyarblunch.
remote:
To https://git.heroku.com/shibuyarblunch.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shibuyarblunch.git'

結局改めて Ruby のバージョンを指定し直した。

github.com

これ既視感あるなあと思って作業中にブログを検索したらやっぱり同じ目にあっていた。二回も。

これで三回目。普段使いしてないせいで覚えてなくて毎回ハマる方も悪いが、なぜ古い Ruby をインストールしようとするのか結局理由がわかってないし、デプロイしてるソースコードにはどこにも問題ないように思えるので Heroku 側の問題なはずで、ずっと治ってない(既知の問題として検索してすぐ対策が出てもこない)のもどうかと思う。