Add deploy hooks to your Heroku app.
Use a Heroku deploy hook to:
Configure Heroku to automatically notify Bugsnag of a new deploy of your app by enabling the Deploy Hooks add-on and configuring a HTTP post hook. You can configure one using the Heroku CLI by running:
heroku addons:create deployhooks:http \
--url="https://build.bugsnag.com/heroku?apiKey=API_KEY&releaseStage=RELEASE_STAGE&repository=REPOSITORY"
Replace API_KEY
, RELEASE_STAGE
and REPOSITORY
with appropriate values for your project. The full parameter details see deploy hook parameters.
Once the Deploy Hook has been created Bugsnag will associate version numbers and source control information together to allow you to view diffs and see the quality of your releases within Bugsnag.
For the version provided by the Deploy Hook and your code to match we recommend using the dyno-metadata Heroku Labs feature. This makes the release version used by Heroku available as an environment variable (HEROKU_RELEASE_VERSION
). You can then set your app version in the Bugsnag notifier in your app to that to ensure they match up. For example, in a Ruby app:
Bugsnag.configure do |config|
config.api_key = ENV['BUGSNAG_API_KEY']
config.app_version = ENV['HEROKU_RELEASE_VERSION']
end
The following parameters can be set as URL parameters on the build.bugsnag.com/heroku
URL when setting the deploy hook.
apiKey
Your project’s API key which can be found in your Settings.
releaseStage
The releaseStage configured for this application. Can be omitted and will default to what is configured in your notifier when an event is first received.
repository
The URL to your source control repository, for example https://github.com/org/repo
.
sourceControlProvider
The source control provider you use. Required only for on-premise providers. Must be one of github-enterprise
, bitbucket-server
, or gitlab-onpremise
.