I'm running a self-made app on Heroku, but I encountered a phenomenon that caused an error when building.
This is a Heroku-specific error, and there wasn't much information on the internet, so here's a solution.
View the Build Log from Activity on the console.
Comparing the log at the time of failure and the log at the time of normal, when it fails, it is said that Ruby application-specific Build-related processing such as Ruby app detected
and ʻInstalling bundler 2.0.2` is not performed. understood.
** In case of failure **
-----> nginx-buildpack app detected
./
./nginx
./mime.types
./nginx-debug
-----> nginx-buildpack: Installed nginx/1.18.0 to app/bin
-----> nginx-buildpack: Added start-nginx to app/bin
-----> nginx-buildpack: Added start-nginx-debug to app/bin
-----> nginx-buildpack: Added start-nginx-solo to app/bin
-----> nginx-buildpack: Default mime.types copied to app/config/
-----> nginx-buildpack: Default config copied to app/config.
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 4.9M
-----> Launching...
Released v154
https://supplebox.herokuapp.com/ deployed to Heroku
...Abbreviation
Normal
-----> Ruby app detected
-----> Installing bundler 2.0.2
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.7.1
-----> Installing dependencies using bundler 2.0.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment 'true'`, and stop using this flag
[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set without 'development:test'`, and stop using this flag
[DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs`
Fetching gem metadata from https://rubygems.org/............
Using rake 13.0.1
...Abbreviation
It seems that the cause is not Ruby app detected
.
I knew that Heroku would automatically build for Ruby if it was a Rails application, but I investigated the processing around here.
--About Heroku's Ruby support https://devcenter.heroku.com/articles/ruby-support#rails-6-x-applications
--About Heroku buildpacks https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app#adding-a-buildpack
Apparently, Heroku automatically detects that it is a Ruby application from the source code and automatically builds the application using a series of build processes (build packs).
This event is caused by the Ruby build pack not being started, so I will try adding the build pack manually.
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app#adding-a-buildpack
Check the current build pack and add it by referring to.
Originally there was a build pack called heroku-community / nginx
, but I installed the build packs heroku / nodejs
and heroku / ruby
in order using the ʻindex` option.
$ heroku buildpacks
=== supplebox Buildpack URL
heroku-community/nginx
$ heroku buildpacks:add --index 1 heroku/nodejs
Buildpack added. Next release on supplebox will use:
1. heroku/nodejs
2. heroku-community/nginx
Run git push heroku main to create a new release using these buildpacks.
$ heroku buildpacks:add --index 2 heroku/ruby
Buildpack added. Next release on supplebox will use:
1. heroku/nodejs
2. heroku/ruby
3. heroku-community/nginx
Run git push heroku main to create a new release using these buildpacks.
Heroku doesn't seem to be able to rebuild, so merge and redeploy the PR with an empty commit.
And healed.
The Build Log shows Ruby app detected
, and the Ruby-related build works fine and deploys successfully.
Congratulations.
Recommended Posts