Heroku
Deploy Tracking with Heroku and Rollbar
When your application breaks, you want to know why. It is often because of a code change in a recently deployed release. Rollbar makes it easy to see when new code has been shipped, and what code changed, with the Rollbar Deploy Tracking feature.
Here are the instructions to set up automatic Deploy Tracking for applications on Heroku.
Set up Instructions
Create an access token with post_server_item scope for your Rollbar Project
In the Rollbar UI complete the following steps
- Select the Projects menu from the Rollbar left navigation menu
- Select your Rollbar Project from the list of Projects
- Choose the Project Access Tokens menu item
- Create an access token with the scope
post_server_item
Complete the process using one of the 2 options below
Option 1: Using the Heroku CLI
- Log in to the Heroku CLI
heroku login
- Add the Heroku webhook using the command below ,where ROLLBAR_POST_SERVER_TOKEN is the token created above, and ROLLBAR_ENV is the name of the environment as you want it to appear in Rollbar.
heroku webhooks:add -a YOUR_HEROKU_APPLICATION_NAME -i api:release -u 'https://api.rollbar.com/api/1/webhook/heroku?access_token=ROLLBAR_POST_SERVER_TOKEN&environment=ROLLBAR_ENV' -l notify
For further information on the heroku webhooks:add command options, type
heroku webhooks:add --help
Option 2: Using the Heroku UI
- Log in to the Heroku UI and go to https://dashboard.heroku.com/apps
- Select the Pipeline with your app
- Select the app that you want to notify Rollbar about, when it is released.
- The app Overview screen will now be displayed
- Select the More/View webhooks dropdown option from the upper right of the screen
- Select Create Webhook
- For the Payload URL use the following URL, where ROLLBAR_POST_SERVER_TOKEN is the token created above, and ROLLBAR_ENV is the name of the environment as you want it to appear in Rollbar.
https://api.rollbar.com/api/1/webhook/heroku?access_token=POST_SERVER_ITEM_TOKEN&environment=ROLLBAR_ENV
- Check the
api:release
Event Type
Verify that the process is working
- Confirm that your Rollbar Project has been onboarded, and that the Rollbar Project has received at least 1 item
- Make a minor change to your Heroku application
- Deploy the application. For example, from the Heroku CLI:
git push heroku master
- Within a few seconds of the build completing, you should see the deploy notification in the following locations in Rollbar:
The Items List View
Click on the left-hand Items menu
The Deploys List View
Select the deploy from the left-hand Deploys menu
Deploy Detail
Select the Timestamp link on either of the views above
Updated 11 months ago