How to run a Heroku CLI command from the Heroku Scheduler?

Issue

How can I run a Heroku CLI command from the Heroku Scheduler?

Resolution

The CLI can be installed with the CLI buildpack and you'll need to set a valid API key on your application to run any application-specific commands.

Here are the steps you can follow:

  1. You can generate a key by using heroku authorizations:create on a machine that is currently running an authenticated version of the Heroku CLI and set that key as a config variable HEROKU_API_KEY for your application.

  2. Add the buildpack to your app: heroku buildpacks:add https://github.com/heroku/heroku-buildpack-cli.

These steps should help you run Heroku CLI commands from one-off dynos which the Heroku Scheduler add-on as well runs on.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support