62

I accidentally pushed a build that does an npm install in the postinstall script. This has led to my heroku app being stuck in an infinite install loop. I searched the heroku documentation on how to kill builds but came up blank. The closest thing I found was https://help.heroku.com/Z44Q4WW4/how-do-i-stop-a-release-phase and I tried killing as per those instructions but my build won't die :(

jbccollins
  • 982
  • 1
  • 6
  • 19

3 Answers3

92

If you have a build going into production right now and need to stop it quickly:

heroku plugins:install heroku-builds
heroku builds:cancel -a YOUR_HEROKU_APP_NAME
raine
  • 1,694
  • 17
  • 14
63

The heroku-builds CLI plugin (heroku plugins:install heroku-builds) has a command which will stop a running build:

$ heroku builds:cancel -a your-app-name

All builds will time out too after a time that can go between 15 minutes to 1 hour.

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
Damien MATHIEU
  • 31,924
  • 13
  • 86
  • 94
  • 2
    this workd but one needs to `heroku plugins:install heroku-builds` before, just like explained here https://stackoverflow.com/a/56892546/299774 – Greg Apr 28 '21 at 08:58
  • what if app is a review app? – tikej Apr 11 '22 at 15:49
  • Review apps are apps like any other, with their app name being the part of the hostname before `.herokuapp.com`. So you can kill them exactly the same way. – Damien MATHIEU Apr 13 '22 at 10:06
36

To view all builds run the following in your terminal:

heroku builds -a YOUR_APP_NAME

To cancel a specific (pending) build:

heroku builds:cancel -a YOUR_APP_NAME HEROKU_BUILD_ID

Update (4th July 2020):

If you see the message Warning: builds is not a heroku command, run heroku plugins:install heroku-builds and try again.

Reece Daniels
  • 1,147
  • 12
  • 16