Search code examples
heroku

Is there a way to set which heroku stack (20 for ex.) with the deploy button url?


I am using Heroku's deploy button feature, but in order for my app to work, it needs to be set to the Heroku 20 stack.

Is there a way to do that within the url of the button?

Take a look at the deploy button on this page: https://github.com/stripe/example-terminal-backend


Solution

  • Heroku's deploy buttons are powered by a file called app.json. This file can optionally specify the stack to use:

    stack

    (string, optional) The Heroku stack on which the app will run. If this is not specified, the default stack will be used.

    {
      "stack": "heroku-20"
    }
    

    I suspect you don't have permission to modify that file in the repository you're linking to, but you should be able to fork it and add a stack key to its app.json file.

    Make sure to update the link in your README, too. The repo you've forked links to

    https://heroku.com/deploy?template=https://github.com/stripe/example-terminal-backend
    

    but you'll want to change the template argument to point to your fork.